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 > Internal clock

#40522 - headspin - Tue Apr 19, 2005 8:18 pm

So, the DS has an internal clock right. Has anyone figured out how to access it?

Just curious since it will lead the way for personal organizer type applications etc.

My apologies if this has been discussed before.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#40524 - natrium42 - Tue Apr 19, 2005 8:45 pm

Yes, the DS has a real-time clock. The functions/structures have been in NDSLib from the start :)
_________________
www.natrium42.com

#40568 - Rinkwraith - Wed Apr 20, 2005 2:04 pm

With NDSLib....

The IPC->curtime[] array has 6 values (in positions 0-5 of an 8 value array) for the current date and time.

Not sure what the last two defined array values are for (I always get a 0 for both but haven't tried it on hardware yet).

#40618 - maniacdevnull - Thu Apr 21, 2005 12:04 am

I tried using the IPC->curtime array, but I'm having some trouble. Here's what I got so far:

Code:
consolePrintf("time %2d-%02d-20%02d  %2d:%02d:%02d\n", IPC->curtime[3], IPC->curtime[2], IPC->curtime[1], IPC->curtime[5], IPC->curtime[0], IPC->curtime[4]);


That code works fine in the emulator (Dualis R8), but it doesn't work on hardware. Is there something else I need to be doing to have this look right on hardware?

#40650 - Rinkwraith - Thu Apr 21, 2005 8:45 am

Um... don't know. Haven't tried.

I notice there's usually some code in the ARM7 portion of the template projects; which seems to update the IPC values.

Since Dualis doesn't run the ARM7 code then yours could be missing and you might not know????

I'd guess that if the curTime array wasn't initialised and set (by ARM7) then you'd have problems.

#43460 - Ethos - Mon May 23, 2005 8:04 pm

In my quest for MBC3....

Code:
consolePrintf("%02d-%02d-%02d  %02d:%02d:%02d          \n",
      IPC->rtc_day, IPC->rtc_month, IPC->rtc_year + 2000,
      IPC->rtc_hours - ((IPC->rtc_hours&0x20)>>5)*40,IPC->rtc_minutes,IPC->rtc_seconds);


That should work...looking at bit 6 will tell if its AM/PM.
_________________
Ethos' Homepage (Demos/NDS 3D Tutorial)

#48953 - TaiyouHKabra - Sun Jul 24, 2005 6:01 pm

I was wondering... What is exactly the structure of rtc_hours? I don't understand the calcules you have done to calcule the hour from rtc_hours.

Thanks.