]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/hwclock.h
hwclock: improve audit control
[thirdparty/util-linux.git] / sys-utils / hwclock.h
1 #ifndef HWCLOCK_CLOCK_H
2 #define HWCLOCK_CLOCK_H
3
4 #include <errno.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <time.h>
9
10 #include "c.h"
11
12 enum {
13 RTC_BUSYWAIT_OK = 0,
14 RTC_BUSYWAIT_FAILED,
15 RTC_BUSYWAIT_TIMEOUT
16 };
17
18 struct hwclock_control {
19 char *date_opt;
20 char *adj_file_name;
21 #if defined(__linux__) && defined(__alpha__)
22 unsigned long epoch_option;
23 #endif
24 #ifdef __linux__
25 char *rtc_dev_name;
26 #endif
27 unsigned int debug;
28 unsigned int
29 hwaudit_on:1,
30 adjust:1,
31 show:1,
32 hctosys:1,
33 utc:1,
34 systohc:1,
35 #if defined(__linux__) && defined(__alpha__)
36 getepoch:1,
37 setepoch:1,
38 #endif
39 noadjfile:1,
40 local_opt:1,
41 directisa:1,
42 testing:1,
43 systz:1,
44 predict:1,
45 get:1,
46 set:1,
47 update:1,
48 universal:1; /* will store hw_clock_is_utc() return value */
49 };
50
51 struct clock_ops {
52 char *interface_name;
53 int (*get_permissions) (void);
54 int (*read_hardware_clock) (const struct hwclock_control *ctl, struct tm * tm);
55 int (*set_hardware_clock) (const struct hwclock_control *ctl, const struct tm * tm);
56 int (*synchronize_to_clock_tick) (const struct hwclock_control *ctl);
57 };
58
59 extern struct clock_ops *probe_for_cmos_clock(void);
60 extern struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl);
61
62 typedef int bool;
63
64 /* hwclock.c */
65 extern int debug;
66 extern unsigned long epoch_option;
67 extern double time_diff(struct timeval subtrahend, struct timeval subtractor);
68
69 /* rtc.c */
70 #if defined(__linux__) && defined(__alpha__)
71 extern int get_epoch_rtc(const struct hwclock_control *ctl, unsigned long *epoch);
72 extern int set_epoch_rtc(const struct hwclock_control *ctl);
73 #endif
74
75 extern void hwclock_exit(const struct hwclock_control *ctl, int status);
76
77 #endif /* HWCLOCK_CLOCK_H */