1 /* 2 * Copyright 2006-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Copyright 2003, Jeff Ward, jeff@r2d2.stcloudstate.edu. All rights reserved. 4 * 5 * Distributed under the terms of the MIT License. 6 */ 7 #ifndef _KERNEL_REAL_TIME_CLOCK_H 8 #define _KERNEL_REAL_TIME_CLOCK_H 9 10 11 #include <KernelExport.h> 12 13 #include <time.h> 14 15 16 struct kernel_args; 17 18 19 #define RTC_EPOCH_BASE_YEAR 1970 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 void set_real_time_clock_usecs(bigtime_t currentTime); 26 27 status_t rtc_init(struct kernel_args *args); 28 bigtime_t rtc_boot_time(void); 29 // Returns the time at which the system was booted in microseconds since Jan 1, 1970 UTC. 30 31 // Both functions use the passed struct tm only partially 32 // (no tm_wday, tm_yday, tm_isdst). 33 uint32 rtc_tm_to_secs(const struct tm *t); 34 void rtc_secs_to_tm(uint32 seconds, struct tm *t); 35 36 uint32 get_timezone_offset(void); 37 38 bigtime_t _user_system_time(void); 39 status_t _user_set_real_time_clock(bigtime_t time); 40 status_t _user_set_timezone(int32 timezoneOffset, const char *name, 41 size_t nameLength); 42 status_t _user_get_timezone(int32 *_timezoneOffset, char* name, 43 size_t nameLength); 44 status_t _user_set_real_time_clock_is_gmt(bool isGMT); 45 status_t _user_get_real_time_clock_is_gmt(bool *_isGMT); 46 47 #ifdef __cplusplus 48 } 49 #endif 50 51 #endif /* _KERNEL_REAL_TIME_CLOCK_H */ 52