diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-10-03 19:22:17 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-02-28 03:05:38 -0900 |
commit | a5b5eba7f788bb77cf57f9c94f3474a2d439ab0b (patch) | |
tree | 278813d1b1a9024174531376d41a2ba04a3b27f6 /include/linux/time64.h | |
parent | e4d1c93d85a5b86c04599bfc9f658308d741fd41 (diff) |
New on disk format - encryption
Diffstat (limited to 'include/linux/time64.h')
-rw-r--r-- | include/linux/time64.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/include/linux/time64.h b/include/linux/time64.h index 2e1ad82..2d9f829 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -38,6 +38,19 @@ struct itimerspec64 { #define KTIME_MAX ((s64)~((u64)1 << 63)) #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) +static inline struct timespec ns_to_timespec(const u64 nsec) +{ + return (struct timespec) { + .tv_sec = nsec / NSEC_PER_SEC, + .tv_nsec = nsec % NSEC_PER_SEC, + }; +} + +static inline s64 timespec_to_ns(const struct timespec *ts) +{ + return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; +} + #if __BITS_PER_LONG == 64 static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) @@ -61,11 +74,6 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) # define ns_to_timespec64 ns_to_timespec # define timespec64_add_ns timespec_add_ns -static inline s64 timespec_to_ns(const struct timespec *ts) -{ - return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; -} - #else static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) |