gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Current Time in libnds

#132857 - kalus - Sat Jun 30, 2007 3:31 pm

How do you get current time in milliseconds from libnds? I've found the structure IPC->time.curtime, but it always comes out as zeros. I think I have to do something with it in arm7, but what?

EDIT: ok added rtcGetTime(IPC->time.curtime); to the vblank handler, only problem now is its only updating seconds, nothing more accurate than that. Is getting milliseconds even possible?

#132860 - tepples - Sat Jun 30, 2007 5:51 pm

My first instinct is to add 16, then 17, then 17 to a shared-memory variable in the ARM7's vblank handler, and when it wraps, increment seconds. In order to evaluate whether this situation would work, I'll need to know exactly why you need milliseconds.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#132862 - wintermute - Sat Jun 30, 2007 5:58 pm

The RTC does *not* have millisecond resolution and should not be used for anything other than it's intended purpose - the actual real world time. The next iteration of devkitARM and libnds will allow the use of time() - again without millisecond resolution, it just isn't there.

In order to get finer grained time readings you need to use the timer registers. Some more useful info at http://forum.gbadev.org/viewtopic.php?p=82246#82246
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#132892 - Ant6n - Sun Jul 01, 2007 5:04 am

maybe it'd be possible to write a routine that routinely checks the time in seconds until it changes, then start a timer. but i dont think this could be fine tuned so that the time and the timer change seconds at the same time, so there might be some odd behaviour on some boundaries

#133869 - spinal_cord - Mon Jul 09, 2007 1:44 pm

Is anyone other than me having trouble with the RTC in the lateds devkitpro/libnds release?
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage

#133870 - wintermute - Mon Jul 09, 2007 2:04 pm

There is no RTC support in the current devkitARM/libnds combination with default ARM7 core. As I said above this will be addressed in the next releases, TBA "real soon now"?
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#133980 - spinal_cord - Tue Jul 10, 2007 12:14 am

"real soon" is a time frame I like a lot! Thanks for the info. I was starting to think I killed my code.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage