libnds
Loading...
Searching...
No Matches
Functions
clock.h File Reference

Utilities to read and write the real time clock from the ARM7. More...

#include <nds/arm7/serial.h>
#include <nds/system.h>

Functions

void initClockIRQ (void)
 Initialize the RTC and setup the RTC interrupt to update the time.
 
void initClockIRQTimer (int timer)
 Initialize the RTC and setup a timer interrupt to update the time.
 
void resyncClock (void)
 Reads RTC registers and updates the internal time of libnds.
 
void rtcTimeAndDateGet (rtcTimeAndDate *rtc)
 Fills the provided rtcTimeAndDate structure with the current time and date.
 
int rtcTimeAndDateSet (rtcTimeAndDate *rtc)
 Saves the current time and date to the provided rtcTimeAndDate structure.
 
void rtcTimeGet (rtcTime *rtc)
 Fills the provided rtcTime structure with the current time.
 
int rtcTimeSet (rtcTime *rtc)
 Sets the current time to the provided rtcTime structure.
 

Detailed Description

Utilities to read and write the real time clock from the ARM7.

Function Documentation

◆ initClockIRQ()

void initClockIRQ ( void  )

Initialize the RTC and setup the RTC interrupt to update the time.

Deprecated:
The RTC interrupt isn't supported by the 3DS in DS or DSi modes. Any application that uses it will run on DS and DSi consoles, but not on 3DS. Also, most emulators don't support it either. The alternative is to use initClockIRQTimer(), which uses a timer interrupt instead.

◆ initClockIRQTimer()

void initClockIRQTimer ( int  timer)

Initialize the RTC and setup a timer interrupt to update the time.

Parameters
timerTimer index to use.

◆ rtcTimeAndDateGet()

void rtcTimeAndDateGet ( rtcTimeAndDate rtc)

Fills the provided rtcTimeAndDate structure with the current time and date.

Parameters
rtcPointer to the rtcTimeAndDate struct to fill.

◆ rtcTimeAndDateSet()

int rtcTimeAndDateSet ( rtcTimeAndDate rtc)

Saves the current time and date to the provided rtcTimeAndDate structure.

A returned value of 0 doesn't mean that the RTC registers were updated correctly, only that the checks previous to writing the RTC registers passed.

Note: Check the documentation of rtcOffset in struct tPERSONAL_DATA for additional information.

Parameters
rtcPointer to the rtcTimeAndDate struct with the new time and date.
Returns
If the provided values were valid, it returns 0, else -1.

◆ rtcTimeGet()

void rtcTimeGet ( rtcTime rtc)

Fills the provided rtcTime structure with the current time.

Parameters
rtcPointer to the rtcTime struct to fill.

◆ rtcTimeSet()

int rtcTimeSet ( rtcTime rtc)

Sets the current time to the provided rtcTime structure.

A returned value of 0 doesn't mean that the RTC registers were updated correctly, only that the checks previous to writing the RTC registers passed.

Note: Check the documentation of rtcOffset in struct tPERSONAL_DATA for additional information.

Parameters
rtcPointer to the rtcTime struct with the new time.
Returns
If the provided values were valid, it returns 0, else -1.