libnds: time() value

Post Reply
xyz`
Posts: 1
Joined: Sun Aug 09, 2009 1:42 pm

libnds: time() value

Post by xyz` » Sun Aug 09, 2009 1:53 pm

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.

WinterMute
Site Admin
Posts: 2004
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: libnds: time() value

Post by WinterMute » Mon Aug 10, 2009 12:06 am

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 )

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests