673e410ce9ff6dcbbea86e6e7ef5aff85e61e234
[AROS.git] / arch / ppc-chrp / battclock / readbattclock.c
blob673e410ce9ff6dcbbea86e6e7ef5aff85e61e234
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"
10 /*****************************************************************************
12 NAME */
13 #include <proto/battclock.h>
14 #include <proto/utility.h>
15 #include <proto/rtas.h>
16 #include <proto/exec.h>
17 #include <utility/date.h>
19 AROS_LH0(ULONG, ReadBattClock,
21 /* SYNOPSIS */
22 /* void */
24 /* LOCATION */
25 struct BattClockBase *, BattClockBase, 2, Battclock)
27 /* FUNCTION
28 Return the value stored in the battery back up clock. This value
29 is the number of seconds that have elapsed since midnight on the
30 1st of January 1978 (00:00:00 1.1.1978).
32 If the value of the battery clock is invalid, then the clock will
33 be reset.
35 INPUTS
37 RESULT
38 The number of seconds since 1.1.1978 00:00:00
40 NOTES
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 WriteBattClock, ResetBattClock
49 INTERNALS
51 HISTORY
52 27-11-96 digulla automatically created from
53 battclock_lib.fd and clib/battclock_protos.h
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct ClockData date;
60 void *RTASBase = OpenResource("rtas.resource");
61 ULONG secs;
62 ULONG out[8];
64 RTASCall("get-time-of-day", 0, 8, out, NULL);
66 date.year = out[0];
67 date.month = out[1];
68 date.mday = out[2];
69 date.hour = out[3];
70 date.min = out[4];
71 date.sec = out[5];
73 secs=Date2Amiga(&date);
75 return secs;
77 AROS_LIBFUNC_EXIT
78 } /* ReadBattClock */