2006-03-14 17:29:56 +03:00
|
|
|
/*
|
2007-10-14 21:27:44 +04:00
|
|
|
* Copyright 2006-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
2006-03-14 17:29:56 +03:00
|
|
|
* Copyright 2003, Jeff Ward, jeff@r2d2.stcloudstate.edu. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-10-24 14:21:10 +04:00
|
|
|
#ifndef _KERNEL_REAL_TIME_CLOCK_H
|
|
|
|
#define _KERNEL_REAL_TIME_CLOCK_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <KernelExport.h>
|
|
|
|
|
2006-01-03 20:26:37 +03:00
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
2007-10-14 21:27:44 +04:00
|
|
|
#define RTC_EPOCH_BASE_YEAR 1970
|
2003-10-24 14:21:10 +04:00
|
|
|
|
2006-03-14 17:29:56 +03:00
|
|
|
typedef struct rtc_info {
|
|
|
|
uint32 time;
|
|
|
|
bool is_gmt;
|
|
|
|
int32 tz_minuteswest;
|
|
|
|
bool tz_dsttime;
|
|
|
|
} rtc_info;
|
|
|
|
|
|
|
|
|
2003-10-24 15:58:21 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2003-10-24 14:21:10 +04:00
|
|
|
|
2004-11-05 19:06:28 +03:00
|
|
|
status_t rtc_init(kernel_args *args);
|
2004-11-29 02:23:48 +03:00
|
|
|
bigtime_t rtc_boot_time(void);
|
|
|
|
// Returns the time at which the system was booted in microseconds since Jan 1, 1970 UTC.
|
2003-10-24 15:58:21 +04:00
|
|
|
|
2004-12-15 12:23:50 +03:00
|
|
|
status_t get_rtc_info(rtc_info *info);
|
|
|
|
|
2006-01-03 20:26:37 +03:00
|
|
|
// Both functions use the passed struct tm only partially
|
|
|
|
// (no tm_wday, tm_yday, tm_isdst).
|
|
|
|
uint32 rtc_tm_to_secs(const struct tm *t);
|
|
|
|
void rtc_secs_to_tm(uint32 seconds, struct tm *t);
|
|
|
|
|
2004-11-26 18:00:27 +03:00
|
|
|
bigtime_t _user_system_time(void);
|
2004-11-05 19:06:28 +03:00
|
|
|
status_t _user_set_real_time_clock(uint32 time);
|
2004-11-26 18:00:27 +03:00
|
|
|
status_t _user_set_timezone(int32 timezoneOffset, bool daylightSavingTime);
|
2006-03-14 17:29:56 +03:00
|
|
|
status_t _user_get_timezone(int32 *_timezoneOffset, bool *_daylightSavingTime);
|
2004-11-26 18:00:27 +03:00
|
|
|
status_t _user_set_tzfilename(const char* filename, size_t length, bool isGMT);
|
|
|
|
status_t _user_get_tzfilename(char *filename, size_t length, bool *_isGMT);
|
2003-10-28 16:30:10 +03:00
|
|
|
|
2003-10-24 15:58:21 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2003-10-24 14:21:10 +04:00
|
|
|
|
|
|
|
#endif /* _KERNEL_REAL_TIME_CLOCK_H */
|