2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
7 #include "battclock_intern.h"
9 #include <utility/date.h>
10 #include <proto/utility.h>
12 /*****************************************************************************
15 #include <proto/battclock.h>
17 AROS_LH1(void, WriteBattClock
,
20 AROS_LHA(ULONG
, time
, D0
),
23 struct BattClockBase
*, BattClockBase
, 3, Battclock
)
26 Set the system's battery backed up clock to the time specified. The
27 value should be the number of seconds since 00:00:00 on 1.1.1978.
30 time - The number of seconds elapsed since 00:00:00 1.1.1978
33 The clock will be set.
36 This may not do anything on some systems where the battery backed
37 up clock either doesn't exist, or may not be writable.
44 ReadBattClock(), ResetBattClock()
48 *****************************************************************************/
52 volatile UBYTE
*p
= BattClockBase
->clockptr
;
53 struct UtilityBase
*UtilityBase
= BattClockBase
->UtilityBase
;
59 Amiga2Date(time
, &cd
);
60 stopclock(BattClockBase
);
62 putbcd(p
, reg
, cd
.sec
);
63 putbcd(p
, reg
+ 2, cd
.min
);
64 putbcd(p
, reg
+ 4, cd
.hour
);
65 if (BattClockBase
->clocktype
== MSM6242B
)
69 putbcd(p
, reg
, cd
.mday
);
70 putbcd(p
, reg
+ 2, cd
.month
);
71 putbcd(p
, reg
+ 4, cd
.year
- 1900);
72 startclock(BattClockBase
);
76 } /* WriteBattClock */