aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ktime.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ktime.h')
-rw-r--r--include/linux/ktime.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index e83512f63df5..bbca12804d12 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -330,6 +330,24 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
330 330
331extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); 331extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
332 332
333/**
334 * ktime_to_timespec_cond - convert a ktime_t variable to timespec
335 * format only if the variable contains data
336 * @kt: the ktime_t variable to convert
337 * @ts: the timespec variable to store the result in
338 *
339 * Returns true if there was a successful conversion, false if kt was 0.
340 */
341static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts)
342{
343 if (kt.tv64) {
344 *ts = ktime_to_timespec(kt);
345 return true;
346 } else {
347 return false;
348 }
349}
350
333/* 351/*
334 * The resolution of the clocks. The resolution value is returned in 352 * The resolution of the clocks. The resolution value is returned in
335 * the clock_getres() system call to give application programmers an 353 * the clock_getres() system call to give application programmers an