Hi there,
Do you have any example using mktime function working. I tried calling the mktime from time.h but it is not working.
#define DAY 6 #define MONTH 1 #define YEAR 2016 #define HOUR 19 #define MINUTE 0 #define SECOND 0 #define YEARDIFF 1900 #define MONTHDIFF 1 #include <time.h> #include <stdint.h> static void setTime(void) { struct tm startTime = {0}; time_t ts; /* Set system clock on application microcontroller */ startTime.tm_mday = DAY; startTime.tm_mon = MONTH - MONTHDIFF; startTime.tm_year = YEAR - YEARDIFF; startTime.tm_hour = HOUR; startTime.tm_min = MINUTE; startTime.tm_sec = SECOND; startTime.tm_isdst = -1; ts = mktime(&startTime); UART_PRINT("seconds since the Epoch: %ld\n", (long) ts); }
Thanks
Ganesh