1 |
|
/* |
2 |
|
* timer_unix.cpp - Time Manager emulation, Unix specific stuff |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2001 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
19 |
|
*/ |
20 |
|
|
21 |
|
#include "sysdeps.h" |
22 |
+ |
#include "macos_util.h" |
23 |
|
#include "timer.h" |
24 |
|
|
25 |
|
#define DEBUG 0 |
26 |
|
#include "debug.h" |
27 |
|
|
28 |
+ |
// For NetBSD with broken pthreads headers |
29 |
+ |
#ifndef CLOCK_REALTIME |
30 |
+ |
#define CLOCK_REALTIME 0 |
31 |
+ |
#endif |
32 |
+ |
|
33 |
|
|
34 |
|
/* |
35 |
|
* Return microseconds since boot (64 bit) |
56 |
|
* Return local date/time in Mac format (seconds since 1.1.1904) |
57 |
|
*/ |
58 |
|
|
53 |
– |
const uint32 TIME_OFFSET = 0x7c25b080; // Offset Mac->Unix time in seconds |
54 |
– |
|
59 |
|
uint32 TimerDateTime(void) |
60 |
|
{ |
61 |
< |
time_t uct_now = time(NULL); |
58 |
< |
long tz = timezone; |
59 |
< |
time_t local_now = uct_now - tz; |
60 |
< |
if (daylight) |
61 |
< |
local_now += 3600; |
62 |
< |
return (uint32)local_now + TIME_OFFSET; |
61 |
> |
return TimeToMacTime(time(NULL)); |
62 |
|
} |
63 |
|
|
64 |
|
|