From: Vladimir Serbinenko Date: Wed, 4 Dec 2013 07:26:13 +0000 (+0100) Subject: * grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71 X-Git-Tag: grub-2.02-beta1~173 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40b5739ff955fed86fd859ed0526bf624d8900ef;p=thirdparty%2Fgrub.git * grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71 minutes. --- diff --git a/ChangeLog b/ChangeLog index 024faf8a0..5e0da02c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-12-04 Vladimir Serbinenko + + * grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71 + minutes. + 2013-12-04 Vladimir Serbinenko * grub-core/disk/ieee1275/ofdisk.c: Remove variable length arrays. diff --git a/grub-core/kern/uboot/init.c b/grub-core/kern/uboot/init.c index 9d7924c04..775b689e9 100644 --- a/grub-core/kern/uboot/init.c +++ b/grub-core/kern/uboot/init.c @@ -61,7 +61,13 @@ grub_uboot_get_boot_data (void) static grub_uint64_t uboot_timer_ms (void) { - return (grub_uint64_t) grub_uboot_get_timer (timer_start) / 1000; + static grub_uint32_t last = 0, high = 0; + grub_uint32_t cur = grub_uboot_get_timer (timer_start); + if (cur < last) + high++; + last = cur; + return grub_divmod64 ((((grub_uint64_t) high) << 32) | cur, + 1000, 0); } void