- corrected time zone handling in TimerDateTime()

This commit is contained in:
cebix 1999-10-14 16:05:18 +00:00
parent 62aff59d79
commit 289f0a588a
3 changed files with 14 additions and 9 deletions

View File

@ -1,10 +1,13 @@
V0.7 - V0.7 -
- sony.cpp/disk.cpp/cdrom.cpp: disk insertions are now checked for - sony.cpp/disk.cpp/cdrom.cpp: disk insertions are now checked for
by an interrupt routine by an interrupt routine
- Localizable strings are now split into a common and a platform- - localizable strings are now split into a common and a platform-
specific set specific set
- AmigaOS/clip_amiga.cpp: fixed small bug in CR->LF translation - AmigaOS/clip_amiga.cpp: fixed small bug in CR->LF translation
[Giacomo Magnini] [Giacomo Magnini]
- added patches for NetBSD [Bernd Sieker]
- corrected TimerDateTime() in timer_unix.cpp and timer_beos.cpp
[Toshimitsu Tanaka]
V0.7 (release 0.7-2) - 6.Oct.1999 V0.7 (release 0.7-2) - 6.Oct.1999
- Added BasiliskII.spec for making RPMs [with assistance from - Added BasiliskII.spec for making RPMs [with assistance from

View File

@ -44,14 +44,15 @@ void Microseconds(uint32 &hi, uint32 &lo)
* Return local date/time in Mac format (seconds since 1.1.1904) * Return local date/time in Mac format (seconds since 1.1.1904)
*/ */
const uint32 TIME_OFFSET = 0x7c25cca0; // Offset Mac->BeOS time in seconds const uint32 TIME_OFFSET = 0x7c25b080; // Offset Mac->BeOS time in seconds
uint32 TimerDateTime(void) uint32 TimerDateTime(void)
{ {
time_t uct_now = time(NULL); time_t uct_now = time(NULL);
struct tm tm; long tz = timezone;
localtime_r(&uct_now, &tm); time_t local_now = uct_now - tz;
time_t local_now = mktime(&tm); if (daylight)
local_now += 3600;
return (uint32)local_now + TIME_OFFSET; return (uint32)local_now + TIME_OFFSET;
} }

View File

@ -50,14 +50,15 @@ void Microseconds(uint32 &hi, uint32 &lo)
* Return local date/time in Mac format (seconds since 1.1.1904) * Return local date/time in Mac format (seconds since 1.1.1904)
*/ */
const uint32 TIME_OFFSET = 0x7c25cca0; // Offset Mac->Unix time in seconds const uint32 TIME_OFFSET = 0x7c25b080; // Offset Mac->Unix time in seconds
uint32 TimerDateTime(void) uint32 TimerDateTime(void)
{ {
time_t uct_now = time(NULL); time_t uct_now = time(NULL);
struct tm tm; long tz = timezone;
localtime_r(&uct_now, &tm); time_t local_now = uct_now - tz;
time_t local_now = mktime(&tm); if (daylight)
local_now += 3600;
return (uint32)local_now + TIME_OFFSET; return (uint32)local_now + TIME_OFFSET;
} }