diff --git a/headers/private/kernel/real_time_clock.h b/headers/private/kernel/real_time_clock.h index b24ad4d22b..039745d900 100644 --- a/headers/private/kernel/real_time_clock.h +++ b/headers/private/kernel/real_time_clock.h @@ -17,6 +17,15 @@ status_t rtc_init(kernel_args *args); bigtime_t rtc_boot_time(void); // Returns the time at which the system was booted in microseconds since Jan 1, 1970 UTC. +typedef struct rtc_info { + uint32 time; + bool is_gmt; + int32 tz_minuteswest; + bool tz_dsttime; +} rtc_info; + +status_t get_rtc_info(rtc_info *info); + bigtime_t _user_system_time(void); status_t _user_set_real_time_clock(uint32 time); status_t _user_set_timezone(int32 timezoneOffset, bool daylightSavingTime); diff --git a/src/kernel/core/real_time_clock.c b/src/kernel/core/real_time_clock.c index b59ae135a8..e1b8faec32 100644 --- a/src/kernel/core/real_time_clock.c +++ b/src/kernel/core/real_time_clock.c @@ -144,6 +144,20 @@ real_time_clock_usecs(void) } +status_t +get_rtc_info(rtc_info *info) +{ + if (info == NULL) + return B_BAD_VALUE; + info->time = real_time_clock(); + info->is_gmt = sIsGMT; + info->tz_minuteswest = sTimezoneOffset; + info->tz_dsttime = sDaylightSavingTime; + + return B_OK; +} + + // #pragma mark - // public userland API @@ -219,3 +233,4 @@ _user_get_tzfilename(char *filename, size_t length, bool *_isGMT) return B_OK; } +