KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Real-Time Clock (RTC) Management More...
Files | |
file | rtc.h |
Low-level real-time clock functionality. | |
Functions | |
time_t | rtc_unix_secs (void) |
Get the current date/time. | |
int | rtc_set_unix_secs (time_t time) |
Set the current date/time. | |
time_t | rtc_boot_time (void) |
Get the time since the system was booted. | |
Real-Time Clock (RTC) Management
Provides an API for fetching and managing the date/time using the Dreamcast's real-time clock. All timestamps are in standard Unix format, with an epoch of January 1, 1970. Due to the fact that there is no time zone data on the RTC, all times are expected to be in the local time zone.
time_t rtc_boot_time | ( | void | ) |
Get the time since the system was booted.
This function retrieves the cached RTC value from when KallistiOS was started. As with rtc_unix_secs(), this is a UNIX-style timestamp in local time.
int rtc_set_unix_secs | ( | time_t | time | ) |
Set the current date/time.
This function sets the current RTC value as a standard UNIX timestamp (with an epoch of January 1, 1970 00:00). This is assumed to be in the timezone of the user (as the RTC does not support timezones).
time_t
is typically 64-bit while the RTC uses a 32-bit timestamp (which also has a different epoch), not all time_t
values can be represented within the RTC!time | Unix timestamp to set the current time to |
EINVAL | time was an invalid timestamp or could not be represented on the AICA's RTC. |
EPERM | Failed to set and successfully read back time from the RTC. |
time_t rtc_unix_secs | ( | void | ) |
Get the current date/time.
This function retrieves the current RTC value as a standard UNIX timestamp (with an epoch of January 1, 1970 00:00). This is assumed to be in the timezone of the user (as the RTC does not support timezones).