From 289f0a588aa4b3022281889c0c610e8df8f6ad92 Mon Sep 17 00:00:00 2001 From: cebix <> Date: Thu, 14 Oct 1999 16:05:18 +0000 Subject: [PATCH] - corrected time zone handling in TimerDateTime() --- BasiliskII/ChangeLog | 5 ++++- BasiliskII/src/BeOS/timer_beos.cpp | 9 +++++---- BasiliskII/src/Unix/timer_unix.cpp | 9 +++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/BasiliskII/ChangeLog b/BasiliskII/ChangeLog index 498d6426..3716bc81 100644 --- a/BasiliskII/ChangeLog +++ b/BasiliskII/ChangeLog @@ -1,10 +1,13 @@ V0.7 - - sony.cpp/disk.cpp/cdrom.cpp: disk insertions are now checked for 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 - AmigaOS/clip_amiga.cpp: fixed small bug in CR->LF translation [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 - Added BasiliskII.spec for making RPMs [with assistance from diff --git a/BasiliskII/src/BeOS/timer_beos.cpp b/BasiliskII/src/BeOS/timer_beos.cpp index 6813685a..e8eb20e4 100644 --- a/BasiliskII/src/BeOS/timer_beos.cpp +++ b/BasiliskII/src/BeOS/timer_beos.cpp @@ -44,14 +44,15 @@ void Microseconds(uint32 &hi, uint32 &lo) * 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) { time_t uct_now = time(NULL); - struct tm tm; - localtime_r(&uct_now, &tm); - time_t local_now = mktime(&tm); + long tz = timezone; + time_t local_now = uct_now - tz; + if (daylight) + local_now += 3600; return (uint32)local_now + TIME_OFFSET; } diff --git a/BasiliskII/src/Unix/timer_unix.cpp b/BasiliskII/src/Unix/timer_unix.cpp index 068f572b..24c83406 100644 --- a/BasiliskII/src/Unix/timer_unix.cpp +++ b/BasiliskII/src/Unix/timer_unix.cpp @@ -50,14 +50,15 @@ void Microseconds(uint32 &hi, uint32 &lo) * 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) { time_t uct_now = time(NULL); - struct tm tm; - localtime_r(&uct_now, &tm); - time_t local_now = mktime(&tm); + long tz = timezone; + time_t local_now = uct_now - tz; + if (daylight) + local_now += 3600; return (uint32)local_now + TIME_OFFSET; }