0001
0002 #ifndef _LINUX_TIME_H
0003 #define _LINUX_TIME_H
0004
0005 # include <linux/cache.h>
0006 # include <linux/math64.h>
0007 # include <linux/time64.h>
0008
0009 extern struct timezone sys_tz;
0010
0011 int get_timespec64(struct timespec64 *ts,
0012 const struct __kernel_timespec __user *uts);
0013 int put_timespec64(const struct timespec64 *ts,
0014 struct __kernel_timespec __user *uts);
0015 int get_itimerspec64(struct itimerspec64 *it,
0016 const struct __kernel_itimerspec __user *uit);
0017 int put_itimerspec64(const struct itimerspec64 *it,
0018 struct __kernel_itimerspec __user *uit);
0019
0020 extern time64_t mktime64(const unsigned int year, const unsigned int mon,
0021 const unsigned int day, const unsigned int hour,
0022 const unsigned int min, const unsigned int sec);
0023
0024 #ifdef CONFIG_POSIX_TIMERS
0025 extern void clear_itimer(void);
0026 #else
0027 static inline void clear_itimer(void) {}
0028 #endif
0029
0030 extern long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, int flags);
0031
0032
0033
0034
0035
0036 struct tm {
0037
0038
0039
0040
0041 int tm_sec;
0042
0043 int tm_min;
0044
0045 int tm_hour;
0046
0047 int tm_mday;
0048
0049 int tm_mon;
0050
0051 long tm_year;
0052
0053 int tm_wday;
0054
0055 int tm_yday;
0056 };
0057
0058 void time64_to_tm(time64_t totalsecs, int offset, struct tm *result);
0059
0060 # include <linux/time32.h>
0061
0062 static inline bool itimerspec64_valid(const struct itimerspec64 *its)
0063 {
0064 if (!timespec64_valid(&(its->it_interval)) ||
0065 !timespec64_valid(&(its->it_value)))
0066 return false;
0067
0068 return true;
0069 }
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 #define time_after32(a, b) ((s32)((u32)(b) - (u32)(a)) < 0)
0085 #define time_before32(b, a) time_after32(a, b)
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098 #define time_between32(t, l, h) ((u32)(h) - (u32)(l) >= (u32)(t) - (u32)(l))
0099
0100 # include <vdso/time.h>
0101
0102 #endif