2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id: readbattclock.c 19714 2003-09-09 17:48:30Z hkiel $
5 Desc: ReadBattClock() function.
8 #include "battclock_intern.h"
10 #define ReadRTC(in,out) \
12 "outb %%al,$0x70 \n\t" \
13 "inb $0x71,%%al \n\t" \
14 "movl %%eax,%%ebx \n\t" \
15 "andl $0x0f,%%eax \n\t" \
16 "shrl $4,%%ebx \n\t" \
17 "imul $10,%%ebx \n\t" \
23 /*****************************************************************************
26 #include <proto/battclock.h>
27 #include <proto/utility.h>
28 #include <utility/date.h>
30 AROS_LH0(ULONG
, ReadBattClock
,
36 struct BattClockBase
*, BattClockBase
, 2, Battclock
)
39 Return the value stored in the battery back up clock. This value
40 is the number of seconds that have elapsed since midnight on the
41 1st of January 1978 (00:00:00 1.1.1978).
43 If the value of the battery clock is invalid, then the clock will
49 The number of seconds since 1.1.1978 00:00:00
58 WriteBattClock, ResetBattClock
63 27-11-96 digulla automatically created from
64 battclock_lib.fd and clib/battclock_protos.h
66 *****************************************************************************/
70 struct ClockData date
;
71 #warning HACK: asm statements do not work with a single variable
72 struct __myyear
{ UWORD year
; } myyear
;
77 ReadRTC(50,myyear
.year
);
79 ReadRTC(8,date
.month
);
84 // date.year+=100*year;
85 date
.year
+=100*myyear
.year
;
87 secs
=Date2Amiga(&date
);