30 |
|
#include "debug.h" |
31 |
|
|
32 |
|
|
33 |
– |
// Assembly functions |
34 |
– |
extern "C" ULONG TimevalTo64(struct timeval *, ULONG *); |
35 |
– |
extern "C" LONG TimevalToMacTime(struct timeval *); |
36 |
– |
|
37 |
– |
|
33 |
|
/* |
34 |
|
* Return microseconds since boot (64 bit) |
35 |
|
*/ |
39 |
|
D(bug("Microseconds\n")); |
40 |
|
struct timeval tv; |
41 |
|
GetSysTime(&tv); |
42 |
< |
lo = TimevalTo64(&tv, &hi); |
42 |
> |
uint64 tl = (uint64)tv.tv_secs * 1000000 + tv.tv_micro; |
43 |
> |
hi = tl >> 32; |
44 |
> |
lo = tl; |
45 |
|
} |
46 |
|
|
47 |
|
|
49 |
|
* Return local date/time in Mac format (seconds since 1.1.1904) |
50 |
|
*/ |
51 |
|
|
55 |
– |
const uint32 TIME_OFFSET = 0x8b31ef80; // Offset Mac->Amiga time in seconds |
56 |
– |
|
52 |
|
uint32 TimerDateTime(void) |
53 |
|
{ |
54 |
|
ULONG secs; |
126 |
|
{ |
127 |
|
if (hosttime.tv_secs < 0) |
128 |
|
return 0; |
129 |
< |
else |
130 |
< |
return TimevalToMacTime(&hosttime); |
129 |
> |
else { |
130 |
> |
uint64 t = (uint64)hosttime.tv_secs * 1000000 + hosttime.tv_micro; |
131 |
> |
if (t > 0x7fffffff) |
132 |
> |
return t / 1000; // Time in milliseconds |
133 |
> |
else |
134 |
> |
return -t; // Time in negative microseconds |
135 |
> |
} |
136 |
|
} |