fix integer overflow after 50 days (thx Hauke Mehrtens)
authorSteven Barth <steven@midlink.org>
Fri, 7 Mar 2014 09:33:49 +0000 (10:33 +0100)
committerSteven Barth <steven@midlink.org>
Fri, 7 Mar 2014 09:33:49 +0000 (10:33 +0100)
src/odhcp6c.c

index 3c6b3b05abd8db9eaeedb92dcf270dee90d8625b..ba11ced6d23af32e47676f40159951f6341fa6b9 100644 (file)
@@ -470,7 +470,7 @@ uint64_t odhcp6c_get_milli_time(void)
 {
        struct timespec t = {0, 0};
        syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &t);
-       return t.tv_sec * 1000 + t.tv_nsec / 1000000;
+       return ((uint64_t)t.tv_sec) * 1000 + ((uint64_t)t.tv_nsec) / 1000000;
 }