revert between 56095 -> 55830 in arch
[AROS.git] / arch / ppc-chrp / battclock / writebattclock.c
blob8e6024ff01550a3f9808a6c0ad06bd6a0beea52e
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: WriteBattClock()
6 Lang: english
7 */
8 #include "battclock_intern.h"
10 static int rtas_call(const char *method, int nargs, int nret, void *output, ...);
12 #include <proto/battclock.h>
13 #include <proto/utility.h>
14 #include <proto/rtas.h>
15 #include <proto/exec.h>
16 #include <utility/date.h>
17 #include <stdarg.h>
19 /* See rom/battclock/writebattclock.c for documentation */
21 AROS_LH1(void, WriteBattClock,
22 AROS_LHA(ULONG, time, D0),
23 APTR *, BattClockBase, 3, Battclock)
25 AROS_LIBFUNC_INIT
27 struct ClockData date;
28 ULONG out[8];
30 Amiga2Date(time, &date);
32 rtas_call("set-time-of-day", 7, 1, NULL, (ULONG)date.year, (ULONG)date.month, (ULONG)date.mday, (ULONG)date.hour, (ULONG)date.min, (ULONG)date.sec, 0);
34 AROS_LIBFUNC_EXIT
35 } /* WriteBattClock */
37 static int rtas_call(const char *method, int nargs, int nret, void *output, ...)
39 va_list args;
40 void *RTASBase = OpenResource("rtas.resource");
41 int retval;
43 va_start(args, output);
44 retval = RTASCall(method, nargs, nret, output, args);
45 va_end(args);
47 return retval;