Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b17b20d7 authored by John Stultz's avatar John Stultz
Browse files

ktime: Change ktime_set() to take 64bit seconds value



In order to support dates past 2038 on 32bit systems, ktime_set()
needs to handle 64bit second values.

[ tglx: Removed the BITS_PER_LONG check ]

Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 166afb64
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -47,13 +47,12 @@ typedef union ktime ktime_t; /* Kill this */
 *
 * Return: The ktime_t representation of the value.
 */
static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs)
{
#if (BITS_PER_LONG == 64)
	if (unlikely(secs >= KTIME_SEC_MAX))
		return (ktime_t){ .tv64 = KTIME_MAX };
#endif
	return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs };

	return (ktime_t) { .tv64 = secs * NSEC_PER_SEC + (s64)nsecs };
}

/* Subtract two ktime_t variables. rem = lhs -rhs: */