Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / .unmaintained / m68k-pp-native / battclock / readbattclock.c
blobed42226fe65e3ea3e4656a50837eb5187c2ff028
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ReadBattClock() function.
6 Lang: english
7 */
8 #include "battclock_intern.h"
9 #include <asm/registers.h>
11 /*****************************************************************************
13 NAME */
14 #include <proto/battclock.h>
15 #include <proto/utility.h>
16 #include <utility/date.h>
18 AROS_LH0(ULONG, ReadBattClock,
20 /* SYNOPSIS */
21 /* void */
23 /* LOCATION */
24 struct BattClockBase *, BattClockBase, 2, Battclock)
26 /* FUNCTION
27 Return the value stored in the battery back up clock. This value
28 is the number of seconds that have elapsed since midnight on the
29 1st of January 1978 (00:00:00 1.1.1978).
31 If the value of the battery clock is invalid, then the clock will
32 be reset.
34 INPUTS
36 RESULT
37 The number of seconds since 1.1.1978 00:00:00
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 WriteBattClock, ResetBattClock
48 INTERNALS
50 HISTORY
51 27-11-96 digulla automatically created from
52 battclock_lib.fd and clib/battclock_protos.h
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 struct ClockData date;
59 ULONG secs;
60 ULONG rtctime = RREG_L(RTCTIME);
62 date.sec = (rtctime & SECONDS_M);
63 date.min = (rtctime & MINUTES_M) >> 16;
64 date.hour = (rtctime & HOURS_M ) >> 24;
66 date.mday = 0;
67 date.month = 0;
68 date.year = 0;
70 secs = Date2Amiga(&date);
72 return secs;
74 AROS_LIBFUNC_EXIT
75 } /* ReadBattClock */