Time.h usage error?


#1

Hello;
this code is working on RTE debug mode. But I cant use on target mode. Im getting “+WIND: 12,1” error.

#include <time.h>

  time_t now, tGPRS,tOLCUM,tPIL;
  char datetime[50],string[50]; 

void showGPRSTime(void){
  time (&now);
  tGPRS= now+1000;
  strftime(datetime, sizeof(datetime), "%H:%M:%S", localtime (&tGPRS));      
  sprintf( string, "tGPRS %s", datetime);
  SEND_TRACE( string );
}

What can I do, any idea?
Gokhan :imp:


#2

+WIND: 12, as far as I understand, is not an error, only an interrupt indication. I thought that can only be triggered by the external, physical INTR pins (this is what I see when I trigger those pins), but might be wrong.

Anyway, as for the time.h functions, they don’t work. rand() etc do work, but the time functions do not. I don’t know of a way to get them working (if anyone does that would be great), but you can use (on Q26…) the RTC API, which gives you unixtime and also some break-up options. If you want a standard formatted string, call AT+CCLK? and parse the response.