Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / arch / all-unix / battclock / readbattclock.c
blobec1013688b9b96f491a1c5cfbfe004adc8a4fc39
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ReadBattClock() function.
6 Lang: english
7 */
9 #include <proto/battclock.h>
10 #include <proto/utility.h>
11 #include <utility/date.h>
13 #include "battclock_intern.h"
15 AROS_LH0(ULONG, ReadBattClock, struct BattClockBase *, BattClockBase, 2, Battclock)
17 AROS_LIBFUNC_INIT
19 time_t t;
20 struct tm *tm;
21 struct ClockData date;
23 BattClockBase->SysIFace->time(&t);
24 AROS_HOST_BARRIER
27 * On UNIX time() returns local time instead of GMT.
28 * So we have all this clutter. Note that we use host function
29 * in order to convert to GMT while we could in fact use AROS one.
30 * This is because theoretically AROS and our host can be set
31 * to different time zones. Additionally we use host OS includes
32 * for definitions of struct tm and time_t.
34 tm = BattClockBase->SysIFace->localtime(&t);
35 AROS_HOST_BARRIER
37 date.year = tm->tm_year + 1900;
38 date.month = tm->tm_mon + 1;
39 date.mday = tm->tm_mday;
40 date.hour = tm->tm_hour;
41 date.min = tm->tm_min;
42 date.sec = tm->tm_sec;
44 return Date2Amiga(&date);
46 AROS_LIBFUNC_EXIT
47 } /* ReadBattClock */