asctime
Posted: Mon Nov 03, 2014 9:30 pm
I am using NNDK 2.6.8
I have just looked at some RTC routines and have found that the string generated by asctime is not correct
the following code:
generates the following output
Current local time: TueWedThuFriSat NovDecSunMonTueWedThuFriSat 4 13:11:57 2014
the correct string should be ??
Current local time: Tue Nov 4 13:11:57 2014
I did this test on a MOD5441X, but I don't think the platform matters as asctime is a libc routine.
I haven't tried these routines for a while, Has anyone else had any problems?
also ctime seems to have the same problem
EDIT
strftime "%c"
strftime "%a %b %d %H:%M:%S %Y"
these two ways of getting the same string via strftime work fine!!
I have just looked at some RTC routines and have found that the string generated by asctime is not correct
the following code:
Code: Select all
time_t RawTime;
struct tm *TimeInfo;
RawTime = time( NULL ); // Get system time in time_t format
TimeInfo = localtime( &RawTime ); // Convert to struct tm format
iprintf("Current local time: %s\r\n", asctime( TimeInfo ) );
Current local time: TueWedThuFriSat NovDecSunMonTueWedThuFriSat 4 13:11:57 2014
the correct string should be ??
Current local time: Tue Nov 4 13:11:57 2014
I did this test on a MOD5441X, but I don't think the platform matters as asctime is a libc routine.
I haven't tried these routines for a while, Has anyone else had any problems?
also ctime seems to have the same problem
EDIT
strftime "%c"
strftime "%a %b %d %H:%M:%S %Y"
these two ways of getting the same string via strftime work fine!!