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 status_t rtc_init(struct kernel_args *args); 26 bigtime_t rtc_boot_time(void); 27 // Returns the time at which the system was booted in microseconds since Jan 1, 1970 UTC. 28 29 // Both functions use the passed struct tm only partially 30 // (no tm_wday, tm_yday, tm_isdst). 31 uint32 rtc_tm_to_secs(const struct tm *t); 32 void rtc_secs_to_tm(uint32 seconds, struct tm *t); 33 34 uint32 get_timezone_offset(void); 35 36 bigtime_t _user_system_time(void); 37 status_t _user_set_real_time_clock(uint32 time); 38 status_t _user_set_timezone(int32 timezoneOffset, const char *name, 39 size_t nameLength); 40 status_t _user_get_timezone(int32 *_timezoneOffset, char* name, 41 size_t nameLength); 42 status_t _user_set_real_time_clock_is_gmt(bool isGMT); 43 status_t _user_get_real_time_clock_is_gmt(bool *_isGMT); 44 45 #ifdef __cplusplus 46 } 47 #endif 48 49 #endif /* _KERNEL_REAL_TIME_CLOCK_H */ 50