1
2#ifndef _LINUX_TIME_H
3#define _LINUX_TIME_H
4
5# include <linux/cache.h>
6# include <linux/seqlock.h>
7# include <linux/math64.h>
8# include <linux/time64.h>
9
10extern struct timezone sys_tz;
11
12int get_timespec64(struct timespec64 *ts,
13 const struct __kernel_timespec __user *uts);
14int put_timespec64(const struct timespec64 *ts,
15 struct __kernel_timespec __user *uts);
16int get_itimerspec64(struct itimerspec64 *it,
17 const struct __kernel_itimerspec __user *uit);
18int put_itimerspec64(const struct itimerspec64 *it,
19 struct __kernel_itimerspec __user *uit);
20
21extern time64_t mktime64(const unsigned int year, const unsigned int mon,
22 const unsigned int day, const unsigned int hour,
23 const unsigned int min, const unsigned int sec);
24
25
26
27
28
29
30
31
32
33
34#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
35extern u32 (*arch_gettimeoffset)(void);
36#endif
37
38struct itimerval;
39extern int do_setitimer(int which, struct itimerval *value,
40 struct itimerval *ovalue);
41extern int do_getitimer(int which, struct itimerval *value);
42
43extern long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, int flags);
44
45
46
47
48
49struct tm {
50
51
52
53
54 int tm_sec;
55
56 int tm_min;
57
58 int tm_hour;
59
60 int tm_mday;
61
62 int tm_mon;
63
64 long tm_year;
65
66 int tm_wday;
67
68 int tm_yday;
69};
70
71void time64_to_tm(time64_t totalsecs, int offset, struct tm *result);
72
73# include <linux/time32.h>
74
75static inline bool itimerspec64_valid(const struct itimerspec64 *its)
76{
77 if (!timespec64_valid(&(its->it_interval)) ||
78 !timespec64_valid(&(its->it_value)))
79 return false;
80
81 return true;
82}
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97#define time_after32(a, b) ((s32)((u32)(b) - (u32)(a)) < 0)
98#define time_before32(b, a) time_after32(a, b)
99#endif
100