From 5622a2e2c58d8e3aebbca99e213fb4999f6c9a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 15 Dec 2004 09:23:50 +0000 Subject: [PATCH] added get_rtc_info, needed in the kernel for services which use local timestamps such as the dos filesystem git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10463 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/real_time_clock.h | 9 +++++++++ src/kernel/core/real_time_clock.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) 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; } +