2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: ReadBattClock() function.
9 #include "battclock_intern.h"
10 #include <proto/battclock.h>
11 #include <proto/utility.h>
12 #include <utility/date.h>
14 #include <aros/host-conf.h>
20 AROS_LH0(ULONG
, ReadBattClock
, struct BattClockBase
*, BattClockBase
, 2, Battclock
)
25 This is mostly an example.
26 It is quite possible that this time value is not for the local
27 timezone, so it has to be converted.
37 struct ClockData date
;
39 date
.year
= tm
->tm_year
+ 1900;
40 date
.month
= tm
->tm_mon
+ 1;
41 date
.mday
= tm
->tm_mday
;
42 date
.hour
= tm
->tm_hour
;
43 date
.min
= tm
->tm_min
;
44 date
.sec
= tm
->tm_sec
;
46 return Date2Amiga(&date
);
51 This time is however relative to 1.1.1970, so we have to subtract a
52 large number of seconds so that things actually work correctly.
54 There is a problem here that 8 years before the Amiga clock dies,
55 the Unix system clock will have problems as it will wrap around.
56 Still, I'll be dead, and by then they won't be using 32-bit clocks
59 #ifdef HAVE_STRUCT_TM_TM_GMTOFF
60 return (t
- 252460800 + tm
->tm_gmtoff
);
62 return (t
- 252460800);