]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/hwclock.h
su: change error message
[thirdparty/util-linux.git] / sys-utils / hwclock.h
CommitLineData
9abb2685
KZ
1#ifndef HWCLOCK_CLOCK_H
2#define HWCLOCK_CLOCK_H
3
7eda085c 4#include <stdio.h>
66ee8158 5#include <stdlib.h>
7eda085c 6#include <string.h>
f2ff0adf 7#include <sys/time.h>
7eda085c
KZ
8#include <time.h>
9
b940bae3 10#include "c.h"
ff4e18bd
WP
11#include "debug.h"
12
13#define HWCLOCK_DEBUG_INIT (1 << 0)
14#define HWCLOCK_DEBUG_RANDOM_SLEEP (1 << 1)
15#define HWCLOCK_DEBUG_DELTA_VS_TARGET (1 << 2)
16#define HWCLOCK_DEBUG_ALL 0xFFFF
17
18UL_DEBUG_DECLARE_MASK(hwclock);
19#define DBG(m, x) __UL_DBG(hwclock, HWCLOCK_DEBUG_, m, x)
20#define ON_DBG(m, x) __UL_DBG_CALL(hwclock, HWCLOCK_DEBUG_, m, x)
b940bae3 21
336f7c5f
SK
22struct hwclock_control {
23 char *date_opt;
336f7c5f 24 char *adj_file_name;
df4f1a66 25 double rtc_delay; /* --delay <seconds> */
039a0cec 26#if defined(__linux__) && defined(__alpha__)
f7599b4f 27 char *epoch_option;
039a0cec 28#endif
336f7c5f
SK
29#ifdef __linux__
30 char *rtc_dev_name;
31#endif
336f7c5f 32 unsigned int
336f7c5f 33 hwaudit_on:1,
336f7c5f 34 adjust:1,
336f7c5f
SK
35 show:1,
36 hctosys:1,
37 utc:1,
38 systohc:1,
039a0cec 39#if defined(__linux__) && defined(__alpha__)
336f7c5f
SK
40 getepoch:1,
41 setepoch:1,
42#endif
43 noadjfile:1,
44 local_opt:1,
336f7c5f
SK
45 directisa:1,
46 testing:1,
47 systz:1,
48 predict:1,
49 get:1,
50 set:1,
51 update:1,
ff4e18bd
WP
52 universal:1, /* will store hw_clock_is_utc() return value */
53 verbose:1;
336f7c5f
SK
54};
55
7eda085c
KZ
56struct clock_ops {
57 char *interface_name;
ef71b8f1 58 int (*get_permissions) (void);
336f7c5f
SK
59 int (*read_hardware_clock) (const struct hwclock_control *ctl, struct tm * tm);
60 int (*set_hardware_clock) (const struct hwclock_control *ctl, const struct tm * tm);
61 int (*synchronize_to_clock_tick) (const struct hwclock_control *ctl);
df4f1a66 62 const char *(*get_device_path) (void);
7eda085c
KZ
63};
64
65extern struct clock_ops *probe_for_cmos_clock(void);
336f7c5f 66extern struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl);
7eda085c 67
7eda085c 68/* hwclock.c */
982a4a5d 69extern double time_diff(struct timeval subtrahend, struct timeval subtractor);
7eda085c
KZ
70
71/* rtc.c */
039a0cec 72#if defined(__linux__) && defined(__alpha__)
af68bd01 73extern int get_epoch_rtc(const struct hwclock_control *ctl, unsigned long *epoch);
336f7c5f 74extern int set_epoch_rtc(const struct hwclock_control *ctl);
039a0cec 75#endif
88058a71 76
39ff5b34
RM
77extern void __attribute__((__noreturn__))
78hwclock_exit(const struct hwclock_control *ctl, int status);
9abb2685 79
ef71b8f1 80#endif /* HWCLOCK_CLOCK_H */