This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Get a timestamp in nRF51822 BLUETOOTH SMART BEACON KIT

Hi,

I'm trying to get a time stamp using that kit, but I'm having problems doing it because always I upload the code to the kit, it stops working.

I add here the code related with the time stamp:

//funcion declaration code
    void getConcatTimestamp(char **year){
   time_t rawtime;
   struct tm * timeinfo;
	 //char *buffer; I don't use this because a developer talked me some issues with the dynamic //memory
	static char buffer[10]; 

   time ( &rawtime );
   timeinfo = localtime ( &rawtime );
	
		 strftime (buffer,10,"%y",timeinfo);

	*year=buffer;
	
}

And in the main:

    char *anio=NULL;
getConcatTimestamp(&anio);

As I upload the code to the device it stops working. Any idea about how can I fix this?

Regards.

Iván

Related