AnsweredAssumed Answered

MQX and time.h

Question asked by Carl Norman on Jan 28, 2010
Latest reply on Jan 28, 2010 by Carl Norman

Would someone be kind enough to share their RTC to Actual Time/Date conversion? Here is some code that works on my PC to convert to date and tim, but the data types are different in MQX along with something else:



/* a sample program that return local time. */#include <stdio.h>#include <time.h>int main() {    struct tm *ptr;    time_t lt;        lt = time(NULL);       //return system time    printf("time(NULL) = %d\n", lt);    ptr = localtime(&lt);  // return time in the form of tm structure    printf(asctime(ptr));}


time(NULL) = 941830207
Fri Nov  5 14:30:07 1999