diff options
Diffstat (limited to 'include/linux/time.h')
-rw-r--r-- | include/linux/time.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index ea3559f0b3f2..cb34e35fabac 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -76,9 +76,25 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon, | |||
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, s64 nsec); | 78 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); |
79 | |||
80 | /* | ||
81 | * timespec_add_safe assumes both values are positive and checks | ||
82 | * for overflow. It will return TIME_T_MAX if the reutrn would be | ||
83 | * smaller then either of the arguments. | ||
84 | */ | ||
79 | extern struct timespec timespec_add_safe(const struct timespec lhs, | 85 | extern struct timespec timespec_add_safe(const struct timespec lhs, |
80 | const struct timespec rhs); | 86 | const struct timespec rhs); |
81 | 87 | ||
88 | |||
89 | static inline struct timespec timespec_add(struct timespec lhs, | ||
90 | struct timespec rhs) | ||
91 | { | ||
92 | struct timespec ts_delta; | ||
93 | set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec, | ||
94 | lhs.tv_nsec + rhs.tv_nsec); | ||
95 | return ts_delta; | ||
96 | } | ||
97 | |||
82 | /* | 98 | /* |
83 | * sub = lhs - rhs, in normalized form | 99 | * sub = lhs - rhs, in normalized form |
84 | */ | 100 | */ |
@@ -97,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs, | |||
97 | #define timespec_valid(ts) \ | 113 | #define timespec_valid(ts) \ |
98 | (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) | 114 | (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) |
99 | 115 | ||
100 | extern struct timespec xtime; | ||
101 | extern struct timespec wall_to_monotonic; | ||
102 | extern seqlock_t xtime_lock; | 116 | extern seqlock_t xtime_lock; |
103 | 117 | ||
104 | extern void read_persistent_clock(struct timespec *ts); | 118 | extern void read_persistent_clock(struct timespec *ts); |
@@ -110,7 +124,8 @@ extern int timekeeping_suspended; | |||
110 | 124 | ||
111 | unsigned long get_seconds(void); | 125 | unsigned long get_seconds(void); |
112 | struct timespec current_kernel_time(void); | 126 | struct timespec current_kernel_time(void); |
113 | struct timespec __current_kernel_time(void); /* does not hold xtime_lock */ | 127 | struct timespec __current_kernel_time(void); /* does not take xtime_lock */ |
128 | struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */ | ||
114 | struct timespec get_monotonic_coarse(void); | 129 | struct timespec get_monotonic_coarse(void); |
115 | 130 | ||
116 | #define CURRENT_TIME (current_kernel_time()) | 131 | #define CURRENT_TIME (current_kernel_time()) |