diff options
Diffstat (limited to 'include/linux/time.h')
-rw-r--r-- | include/linux/time.h | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index ea16c1a01d51..fe04e5ef6a59 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -75,7 +75,7 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon, | |||
75 | const unsigned int day, const unsigned int hour, | 75 | const unsigned int day, const unsigned int hour, |
76 | const unsigned int min, const unsigned int sec); | 76 | const unsigned int min, const unsigned int sec); |
77 | 77 | ||
78 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); | 78 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); |
79 | extern struct timespec timespec_add_safe(const struct timespec lhs, | 79 | extern struct timespec timespec_add_safe(const struct timespec lhs, |
80 | const struct timespec rhs); | 80 | const struct timespec rhs); |
81 | 81 | ||
@@ -101,7 +101,8 @@ extern struct timespec xtime; | |||
101 | extern struct timespec wall_to_monotonic; | 101 | extern struct timespec wall_to_monotonic; |
102 | extern seqlock_t xtime_lock; | 102 | extern seqlock_t xtime_lock; |
103 | 103 | ||
104 | extern unsigned long read_persistent_clock(void); | 104 | extern void read_persistent_clock(struct timespec *ts); |
105 | extern void read_boot_clock(struct timespec *ts); | ||
105 | extern int update_persistent_clock(struct timespec now); | 106 | extern int update_persistent_clock(struct timespec now); |
106 | extern int no_sync_cmos_clock __read_mostly; | 107 | extern int no_sync_cmos_clock __read_mostly; |
107 | void timekeeping_init(void); | 108 | void timekeeping_init(void); |
@@ -109,6 +110,8 @@ extern int timekeeping_suspended; | |||
109 | 110 | ||
110 | unsigned long get_seconds(void); | 111 | unsigned long get_seconds(void); |
111 | struct timespec current_kernel_time(void); | 112 | struct timespec current_kernel_time(void); |
113 | struct timespec __current_kernel_time(void); /* does not hold xtime_lock */ | ||
114 | struct timespec get_monotonic_coarse(void); | ||
112 | 115 | ||
113 | #define CURRENT_TIME (current_kernel_time()) | 116 | #define CURRENT_TIME (current_kernel_time()) |
114 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) | 117 | #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) |
@@ -147,10 +150,39 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | |||
147 | extern int timekeeping_valid_for_hres(void); | 150 | extern int timekeeping_valid_for_hres(void); |
148 | extern void update_wall_time(void); | 151 | extern void update_wall_time(void); |
149 | extern void update_xtime_cache(u64 nsec); | 152 | extern void update_xtime_cache(u64 nsec); |
153 | extern void timekeeping_leap_insert(int leapsecond); | ||
150 | 154 | ||
151 | struct tms; | 155 | struct tms; |
152 | extern void do_sys_times(struct tms *); | 156 | extern void do_sys_times(struct tms *); |
153 | 157 | ||
158 | /* | ||
159 | * Similar to the struct tm in userspace <time.h>, but it needs to be here so | ||
160 | * that the kernel source is self contained. | ||
161 | */ | ||
162 | struct tm { | ||
163 | /* | ||
164 | * the number of seconds after the minute, normally in the range | ||
165 | * 0 to 59, but can be up to 60 to allow for leap seconds | ||
166 | */ | ||
167 | int tm_sec; | ||
168 | /* the number of minutes after the hour, in the range 0 to 59*/ | ||
169 | int tm_min; | ||
170 | /* the number of hours past midnight, in the range 0 to 23 */ | ||
171 | int tm_hour; | ||
172 | /* the day of the month, in the range 1 to 31 */ | ||
173 | int tm_mday; | ||
174 | /* the number of months since January, in the range 0 to 11 */ | ||
175 | int tm_mon; | ||
176 | /* the number of years since 1900 */ | ||
177 | long tm_year; | ||
178 | /* the number of days since Sunday, in the range 0 to 6 */ | ||
179 | int tm_wday; | ||
180 | /* the number of days since January 1, in the range 0 to 365 */ | ||
181 | int tm_yday; | ||
182 | }; | ||
183 | |||
184 | void time_to_tm(time_t totalsecs, int offset, struct tm *result); | ||
185 | |||
154 | /** | 186 | /** |
155 | * timespec_to_ns - Convert timespec to nanoseconds | 187 | * timespec_to_ns - Convert timespec to nanoseconds |
156 | * @ts: pointer to the timespec variable to be converted | 188 | * @ts: pointer to the timespec variable to be converted |
@@ -241,6 +273,8 @@ struct itimerval { | |||
241 | #define CLOCK_PROCESS_CPUTIME_ID 2 | 273 | #define CLOCK_PROCESS_CPUTIME_ID 2 |
242 | #define CLOCK_THREAD_CPUTIME_ID 3 | 274 | #define CLOCK_THREAD_CPUTIME_ID 3 |
243 | #define CLOCK_MONOTONIC_RAW 4 | 275 | #define CLOCK_MONOTONIC_RAW 4 |
276 | #define CLOCK_REALTIME_COARSE 5 | ||
277 | #define CLOCK_MONOTONIC_COARSE 6 | ||
244 | 278 | ||
245 | /* | 279 | /* |
246 | * The IDs of various hardware clocks: | 280 | * The IDs of various hardware clocks: |