Page 1 of 1

libnds: time() value

Posted: Sun Aug 09, 2009 1:53 pm
by xyz`
the time() function seems to return an inaccurate value.

on my computer, I get 1249821101, but on the ds it shows 1249795886. (~25000 seconds difference)

but when I do:

Code: Select all

time_t ut = time(NULL);
tm* z = localtime(&ut);
printf("%d:%d:%d",  z->tm_hour, z->tm_min, z->tm_sec);
on the ds, it correctly says that the time is 5:30.

using libnds 1.3.7 and devkitARM r25.

Re: libnds: time() value

Posted: Mon Aug 10, 2009 12:06 am
by WinterMute
The DS doesn't store a timezone so right now the libnds/newlib code works as if the time set in the RTC was UTC. This gives the discrepancy of ~7 hours since you're in GMT - 8 ( +1 for daylight savings time )