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 > Problem getting time

#95219 - Turambar - Fri Jul 28, 2006 6:36 am

I'm trying to show the time and date, but it doesn't work. This is my code in the arm9:
Code:

   int hours, minutes, seconds;

      hours = (IPC->rtc_hours < 12) ? IPC->rtc_hours : IPC->rtc_hours - 52;
      minutes = IPC->rtc_minutes;
      seconds = IPC->rtc_seconds;
      printf("\n%i:%i:%i%s", hours, minutes, seconds, IPC->rtc_hours > 52 ? "pm" : "am");
      printf("\n%i/%i/%i",IPC->rtc_day, IPC->rtc_month, IPC->rtc_year + 2000);

and this in the arm7:
Code:

         uint8 ct[sizeof(IPC->curtime)];
         u32 i;
         // Read the time
         rtcGetTime((uint8 *)ct);
         BCDToInteger((uint8 *)&(ct[1]), 7);    
         
         for(i=0; i<sizeof(ct); i++) {
           IPC->curtime[i] = ct[i];
         }

I get minutes, seconds, days and months all 0, but hours 4 and years 3...
I don't know what's the problem. The arm9 code runs on the IRQ_VCOUNT