]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71
authorVladimir Serbinenko <phcoder@gmail.com>
Wed, 4 Dec 2013 07:26:13 +0000 (08:26 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Wed, 4 Dec 2013 07:26:39 +0000 (08:26 +0100)
minutes.

ChangeLog
grub-core/kern/uboot/init.c

index 024faf8a083ac43e944bb5773c6a0c45a25e545e..5e0da02c5f0d60d3640f835dfa23441e5fb1f922 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-04  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/kern/uboot/init.c (uboot_timer_ms): Fix overflow after 71
+       minutes.
+
 2013-12-04  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/disk/ieee1275/ofdisk.c: Remove variable length arrays.
index 9d7924c04b3ec50612e23775cd7b7b987703eb84..775b689e977b2a23862129918bdba6216e1b4369 100644 (file)
@@ -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