--- BasiliskII/src/Unix/timer_unix.cpp 1999/10/14 16:05:18 1.2 +++ BasiliskII/src/Unix/timer_unix.cpp 2001/02/02 20:52:58 1.9 @@ -1,7 +1,7 @@ /* * timer_unix.cpp - Time Manager emulation, Unix specific stuff * - * Basilisk II (C) 1997-1999 Christian Bauer + * Basilisk II (C) 1997-2001 Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,11 @@ #define DEBUG 0 #include "debug.h" +// For NetBSD with broken pthreads headers +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + /* * Return microseconds since boot (64 bit) @@ -50,15 +55,16 @@ void Microseconds(uint32 &hi, uint32 &lo * Return local date/time in Mac format (seconds since 1.1.1904) */ -const uint32 TIME_OFFSET = 0x7c25b080; // Offset Mac->Unix time in seconds - uint32 TimerDateTime(void) { - time_t uct_now = time(NULL); - long tz = timezone; - time_t local_now = uct_now - tz; - if (daylight) - local_now += 3600; + time_t utc_now = time(NULL); +#if defined(__linux__) || defined(__SVR4) + time_t local_now = utc_now - timezone; +#elif defined(__FreeBSD__) || defined(__NetBSD__) + time_t local_now = utc_now + localtime(&utc_now)->tm_gmtoff; +#else + time_t local_now = utc_now; +#endif return (uint32)local_now + TIME_OFFSET; }