define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / workbench / prefs / time / prefs.c
blob368758a6d4577060cbb2be9000438fb1119e0e04
1 /*
2 Copyright © 1995-2009, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 /*********************************************************************************************/
11 #include "global.h"
12 #include <aros/macros.h>
14 #define DEBUG 0
15 #include <aros/debug.h>
17 #include <stdio.h>
18 #include <string.h>
19 #include <stdlib.h>
21 /*********************************************************************************************/
23 void InitPrefs(BOOL use, BOOL save)
25 struct timeval tv;
27 GetSysTime(&tv);
28 Amiga2Date(tv.tv_secs, &clockdata);
30 if (use || save) Cleanup(NULL);
33 /*********************************************************************************************/
35 BOOL UsePrefs(void)
37 ULONG secs;
39 secs = Date2Amiga(&clockdata);
41 TimerIO->tr_node.io_Command = TR_SETSYSTIME;
42 TimerIO->tr_time.tv_secs = secs;
43 TimerIO->tr_time.tv_micro = 0;
45 DoIO(&TimerIO->tr_node);
47 return TRUE;
50 /*********************************************************************************************/
52 BOOL SavePrefs(void)
54 ULONG secs;
56 secs = Date2Amiga(&clockdata);
57 WriteBattClock(secs);
58 UsePrefs();
60 return TRUE;
63 /*********************************************************************************************/
65 void RestorePrefs(void)
67 InitPrefs(FALSE, FALSE);
70 /*********************************************************************************************/