]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/timekeeping32.h
1 #ifndef _LINUX_TIMEKEEPING32_H
2 #define _LINUX_TIMEKEEPING32_H
4 * These interfaces are all based on the old timespec type
5 * and should get replaced with the timespec64 based versions
6 * over time so we can remove the file here.
9 static inline void do_gettimeofday(struct timeval
*tv
)
11 struct timespec64 now
;
13 ktime_get_real_ts64(&now
);
14 tv
->tv_sec
= now
.tv_sec
;
15 tv
->tv_usec
= now
.tv_nsec
/1000;
18 static inline unsigned long get_seconds(void)
20 return ktime_get_real_seconds();
23 /* does not take xtime_lock */
24 struct timespec
__current_kernel_time(void);
26 static inline struct timespec
current_kernel_time(void)
28 struct timespec64 now
= current_kernel_time64();
30 return timespec64_to_timespec(now
);
33 #if BITS_PER_LONG == 64
35 * Deprecated. Use do_settimeofday64().
37 static inline int do_settimeofday(const struct timespec
*ts
)
39 return do_settimeofday64(ts
);
42 static inline int __getnstimeofday(struct timespec
*ts
)
44 return __getnstimeofday64(ts
);
47 static inline void getnstimeofday(struct timespec
*ts
)
52 static inline void ktime_get_ts(struct timespec
*ts
)
57 static inline void ktime_get_real_ts(struct timespec
*ts
)
62 static inline void getrawmonotonic(struct timespec
*ts
)
64 getrawmonotonic64(ts
);
67 static inline struct timespec
get_monotonic_coarse(void)
69 return get_monotonic_coarse64();
72 static inline void getboottime(struct timespec
*ts
)
74 return getboottime64(ts
);
78 * Deprecated. Use do_settimeofday64().
80 static inline int do_settimeofday(const struct timespec
*ts
)
82 struct timespec64 ts64
;
84 ts64
= timespec_to_timespec64(*ts
);
85 return do_settimeofday64(&ts64
);
88 static inline int __getnstimeofday(struct timespec
*ts
)
90 struct timespec64 ts64
;
91 int ret
= __getnstimeofday64(&ts64
);
93 *ts
= timespec64_to_timespec(ts64
);
97 static inline void getnstimeofday(struct timespec
*ts
)
99 struct timespec64 ts64
;
101 getnstimeofday64(&ts64
);
102 *ts
= timespec64_to_timespec(ts64
);
105 static inline void ktime_get_ts(struct timespec
*ts
)
107 struct timespec64 ts64
;
109 ktime_get_ts64(&ts64
);
110 *ts
= timespec64_to_timespec(ts64
);
113 static inline void ktime_get_real_ts(struct timespec
*ts
)
115 struct timespec64 ts64
;
117 getnstimeofday64(&ts64
);
118 *ts
= timespec64_to_timespec(ts64
);
121 static inline void getrawmonotonic(struct timespec
*ts
)
123 struct timespec64 ts64
;
125 getrawmonotonic64(&ts64
);
126 *ts
= timespec64_to_timespec(ts64
);
129 static inline struct timespec
get_monotonic_coarse(void)
131 return timespec64_to_timespec(get_monotonic_coarse64());
134 static inline void getboottime(struct timespec
*ts
)
136 struct timespec64 ts64
;
138 getboottime64(&ts64
);
139 *ts
= timespec64_to_timespec(ts64
);
144 * Timespec interfaces utilizing the ktime based ones
146 static inline void get_monotonic_boottime(struct timespec
*ts
)
148 *ts
= ktime_to_timespec(ktime_get_boottime());
151 static inline void timekeeping_clocktai(struct timespec
*ts
)
153 *ts
= ktime_to_timespec(ktime_get_clocktai());
157 * Persistent clock related interfaces
159 extern void read_persistent_clock(struct timespec
*ts
);
160 extern int update_persistent_clock(struct timespec now
);