On Thu, 21 Jun 2012 16:22:50 -0700 "H. Peter Anvin" <hpa@xxxxxxxxx> wrote: > On 06/21/2012 04:18 PM, Andrew Morton wrote: > >> > >> So why is ktime_t unsigned? > > > > err, actually, it isn't. But lots of the APIs to manipulate ktime_t > > use u64. Reason? > > > > I do agree that time quantities should be signed. > > No idea... probably because when representing an actual wall time since > the POSIX epoch that can happen during the poweron time on the system, > the number will be positive since the POSIX epoch predates Linux. > hm. I'll stick this in my tree and see what happens: From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: include/linux/time.h: make NSEC_PER_SEC 64-bit on 32-bit architectures Nanoseconds are usually represented with 64-bit types (s64 and sometimes u64). The 32-bit definition of NSEC_PER_SEC can lead to compile-time and runtime arithmetic overflows on 32-bit systems. So switch NSEC_PER_SEC to a 64-bit type using "LL". Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/time.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN include/linux/time.h~include-linux-timeh-make-nsec_per_sec-64-bit-on-32-bit-architectures include/linux/time.h --- a/include/linux/time.h~include-linux-timeh-make-nsec_per_sec-64-bit-on-32-bit-architectures +++ a/include/linux/time.h @@ -37,7 +37,7 @@ extern struct timezone sys_tz; #define NSEC_PER_USEC 1000L #define NSEC_PER_MSEC 1000000L #define USEC_PER_SEC 1000000L -#define NSEC_PER_SEC 1000000000L +#define NSEC_PER_SEC 1000000000LL #define FSEC_PER_SEC 1000000000000000LL #define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) _ -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html