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.

ASM > Getting NDS RTC value

#45503 - Freakker - Sat Jun 11, 2005 8:24 am

Hello, before I attempt to do it myself, I'm checking to see if anybody has gotten the time from the DS's internal clock.

#45515 - strager - Sat Jun 11, 2005 2:22 pm

Easy:
Code:

const char *months[12] =
{
    "January",
    "February",
    "March",
    ...
    "November",
    "December"
};

...

consolePrintf("Today is:");
consolePrintf("%s %02d, %d\n", months[IPC->rtc_month - 1], IPC->rtc_day, IPC->rtc_year + 2000);
consolePrintf("Current time:");
consolePrintf("%02d:%02d:%02d %sM\n", IPC->rtc_hours > 51 ? IPC->rtc_hours - 51 : IPC->rtc_hours + 1, IPC->rtc_minutes + 1, IPC->rtc_seconds + 1, IPC->rtc_hours > 51 ? "P" : "A");


That is how I would do it.