Rev 4065 | Rev 6082 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4065 | Rev 5270 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef _LINUX_TIME_H |
1 | #ifndef _LINUX_TIME_H |
2 | #define _LINUX_TIME_H |
2 | #define _LINUX_TIME_H |
Line 3... | Line 3... | ||
3 | 3 | ||
4 | //# include |
4 | # include |
5 | //# include |
5 | # include |
6 | # include |
6 | # include |
Line 7... | Line 7... | ||
7 | //#include |
7 | # include |
Line 8... | Line -... | ||
8 | - | ||
9 | extern struct timezone sys_tz; |
- | |
10 | - | ||
11 | /* Parameters used to convert the timespec values: */ |
- | |
12 | #define MSEC_PER_SEC 1000L |
- | |
13 | #define USEC_PER_MSEC 1000L |
- | |
14 | #define NSEC_PER_USEC 1000L |
- | |
15 | #define NSEC_PER_MSEC 1000000L |
- | |
16 | #define USEC_PER_SEC 1000000L |
- | |
17 | #define NSEC_PER_SEC 1000000000L |
8 | |
Line 18... | Line 9... | ||
18 | #define FSEC_PER_SEC 1000000000000000LL |
9 | extern struct timezone sys_tz; |
19 | 10 | ||
20 | #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) |
11 | #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) |
Line 46... | Line 37... | ||
46 | if (lhs->tv_sec > rhs->tv_sec) |
37 | if (lhs->tv_sec > rhs->tv_sec) |
47 | return 1; |
38 | return 1; |
48 | return lhs->tv_usec - rhs->tv_usec; |
39 | return lhs->tv_usec - rhs->tv_usec; |
49 | } |
40 | } |
Line 50... | Line 41... | ||
50 | 41 | ||
51 | extern unsigned long mktime(const unsigned int year, const unsigned int mon, |
42 | extern time64_t mktime64(const unsigned int year, const unsigned int mon, |
52 | const unsigned int day, const unsigned int hour, |
43 | const unsigned int day, const unsigned int hour, |
Line -... | Line 44... | ||
- | 44 | const unsigned int min, const unsigned int sec); |
|
- | 45 | ||
- | 46 | /** |
|
- | 47 | * Deprecated. Use mktime64(). |
|
- | 48 | */ |
|
- | 49 | static inline unsigned long mktime(const unsigned int year, |
|
- | 50 | const unsigned int mon, const unsigned int day, |
|
- | 51 | const unsigned int hour, const unsigned int min, |
|
- | 52 | const unsigned int sec) |
|
- | 53 | { |
|
- | 54 | return mktime64(year, mon, day, hour, min, sec); |
|
53 | const unsigned int min, const unsigned int sec); |
55 | } |
Line 54... | Line 56... | ||
54 | 56 | ||
55 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); |
57 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); |
56 | 58 | ||
Line 82... | Line 84... | ||
82 | set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec, |
84 | set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec, |
83 | lhs.tv_nsec - rhs.tv_nsec); |
85 | lhs.tv_nsec - rhs.tv_nsec); |
84 | return ts_delta; |
86 | return ts_delta; |
85 | } |
87 | } |
Line 86... | Line -... | ||
86 | - | ||
87 | #define KTIME_MAX ((s64)~((u64)1 << 63)) |
- | |
88 | #if (BITS_PER_LONG == 64) |
- | |
89 | # define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) |
- | |
90 | #else |
- | |
91 | # define KTIME_SEC_MAX LONG_MAX |
- | |
92 | #endif |
- | |
93 | 88 | ||
94 | /* |
89 | /* |
95 | * Returns true if the timespec is norm, false if denorm: |
90 | * Returns true if the timespec is norm, false if denorm: |
96 | */ |
91 | */ |
97 | static inline bool timespec_valid(const struct timespec *ts) |
92 | static inline bool timespec_valid(const struct timespec *ts) |
Line 113... | Line 108... | ||
113 | if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) |
108 | if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) |
114 | return false; |
109 | return false; |
115 | return true; |
110 | return true; |
116 | } |
111 | } |
Line 117... | Line -... | ||
117 | - | ||
118 | extern bool persistent_clock_exist; |
- | |
119 | - | ||
120 | static inline bool has_persistent_clock(void) |
- | |
121 | { |
- | |
122 | return persistent_clock_exist; |
- | |
123 | } |
- | |
124 | - | ||
125 | extern void read_persistent_clock(struct timespec *ts); |
- | |
126 | extern void read_boot_clock(struct timespec *ts); |
- | |
127 | extern int persistent_clock_is_local; |
- | |
128 | extern int update_persistent_clock(struct timespec now); |
- | |
129 | void timekeeping_init(void); |
- | |
130 | extern int timekeeping_suspended; |
- | |
131 | - | ||
132 | unsigned long get_seconds(void); |
- | |
133 | struct timespec current_kernel_time(void); |
- | |
134 | struct timespec __current_kernel_time(void); /* does not take xtime_lock */ |
- | |
135 | struct timespec get_monotonic_coarse(void); |
- | |
136 | void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim, |
112 | |
137 | struct timespec *wtom, struct timespec *sleep); |
- | |
Line 138... | Line 113... | ||
138 | void timekeeping_inject_sleeptime(struct timespec *delta); |
113 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
139 | 114 | ||
Line 140... | Line 115... | ||
140 | #define CURRENT_TIME (current_kernel_time()) |
115 | #define CURRENT_TIME (current_kernel_time()) |
Line 151... | Line 126... | ||
151 | */ |
126 | */ |
152 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET |
127 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET |
153 | extern u32 (*arch_gettimeoffset)(void); |
128 | extern u32 (*arch_gettimeoffset)(void); |
154 | #endif |
129 | #endif |
Line 155... | Line -... | ||
155 | - | ||
156 | extern void do_gettimeofday(struct timeval *tv); |
- | |
157 | extern int do_settimeofday(const struct timespec *tv); |
- | |
158 | extern int do_sys_settimeofday(const struct timespec *tv, |
- | |
159 | const struct timezone *tz); |
- | |
160 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) |
- | |
161 | extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); |
130 | |
162 | struct itimerval; |
131 | struct itimerval; |
163 | extern int do_setitimer(int which, struct itimerval *value, |
132 | extern int do_setitimer(int which, struct itimerval *value, |
164 | struct itimerval *ovalue); |
- | |
165 | extern unsigned int alarm_setitimer(unsigned int seconds); |
133 | struct itimerval *ovalue); |
166 | extern int do_getitimer(int which, struct itimerval *value); |
- | |
167 | extern int __getnstimeofday(struct timespec *tv); |
- | |
168 | extern void getnstimeofday(struct timespec *tv); |
- | |
169 | extern void getrawmonotonic(struct timespec *ts); |
- | |
170 | extern void getnstime_raw_and_real(struct timespec *ts_raw, |
- | |
171 | struct timespec *ts_real); |
- | |
172 | extern void getboottime(struct timespec *ts); |
- | |
173 | extern void monotonic_to_bootbased(struct timespec *ts); |
- | |
Line 174... | Line -... | ||
174 | extern void get_monotonic_boottime(struct timespec *ts); |
- | |
175 | - | ||
176 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
- | |
177 | extern int timekeeping_valid_for_hres(void); |
134 | extern int do_getitimer(int which, struct itimerval *value); |
178 | extern u64 timekeeping_max_deferment(void); |
- | |
179 | extern int timekeeping_inject_offset(struct timespec *ts); |
- | |
- | 135 | ||
180 | extern s32 timekeeping_get_tai_offset(void); |
136 | extern unsigned int alarm_setitimer(unsigned int seconds); |
Line 181... | Line 137... | ||
181 | extern void timekeeping_set_tai_offset(s32 tai_offset); |
137 | |
182 | extern void timekeeping_clocktai(struct timespec *ts); |
138 | extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); |
Line 183... | Line 139... | ||
183 | 139 |