* added get_timezone_offset() to kernel, which returns the offset in seconds
* made FAT add-on use get_timezone_offset(), this time correctly adjusted for the difference in units (minutes/seconds) This makes the times in our FAT-fs agree with Linux again, at least :-) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37905 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,13 +13,16 @@
|
||||
#include <time.h>
|
||||
|
||||
|
||||
struct kernel_args;
|
||||
|
||||
|
||||
#define RTC_EPOCH_BASE_YEAR 1970
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
status_t rtc_init(kernel_args *args);
|
||||
status_t rtc_init(struct 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.
|
||||
|
||||
@@ -28,6 +31,8 @@ bigtime_t rtc_boot_time(void);
|
||||
uint32 rtc_tm_to_secs(const struct tm *t);
|
||||
void rtc_secs_to_tm(uint32 seconds, struct tm *t);
|
||||
|
||||
uint32 get_timezone_offset();
|
||||
|
||||
bigtime_t _user_system_time(void);
|
||||
status_t _user_set_real_time_clock(uint32 time);
|
||||
status_t _user_set_timezone(int32 timezoneOffset);
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/* ++++++++++
|
||||
FILE: rtc_info.h
|
||||
NAME: mani
|
||||
DATE: 2/1998
|
||||
Copyright 1999-2001, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
+++++ */
|
||||
|
||||
#ifndef _RTC_INFO_H
|
||||
#define _RTC_INFO_H
|
||||
|
||||
typedef struct {
|
||||
uint32 time;
|
||||
bool is_gmt;
|
||||
int32 tz_minuteswest;
|
||||
int32 tz_dsttime;
|
||||
} rtc_info;
|
||||
|
||||
#define RTC_SETTINGS_FILE "RTC_time_settings"
|
||||
|
||||
extern status_t get_rtc_info(rtc_info *);
|
||||
|
||||
#endif /* _RTC_INFO_H */
|
||||
@@ -7,12 +7,12 @@
|
||||
#include <SupportDefs.h>
|
||||
#include <KernelExport.h>
|
||||
|
||||
#include <real_time_clock.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "rtc_info.h"
|
||||
|
||||
#include "dosfs.h"
|
||||
#include "fat.h"
|
||||
#include "util.h"
|
||||
@@ -72,19 +72,7 @@ get_tzoffset()
|
||||
if (tzoffset != -1)
|
||||
return;
|
||||
|
||||
// tzoffset used to be set to a bogus value (timezone offset in seconds),
|
||||
// we could try to use something like the following ...
|
||||
//
|
||||
// int32 tzOffsetInSeconds;
|
||||
// if (_kern_get_timezone(&tzOffsetInSeconds) < 0) {
|
||||
// dprintf("error getting timezone offset\n");
|
||||
// } else {
|
||||
// tzoffset = tzOffsetInSeconds / 60;
|
||||
// }
|
||||
//
|
||||
// but I'd rather like to spare us the specific kernel call,
|
||||
// so we hardcode the timezone (let's see if it makes any difference)
|
||||
tzoffset = 0;
|
||||
tzoffset = get_timezone_offset() / 60;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -128,6 +128,13 @@ real_time_clock_usecs(void)
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
get_timezone_offset(void)
|
||||
{
|
||||
return (time_t)(sTimezoneOffset / 1000000LL);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user