2013-06-07 18:03:56 +00:00
|
|
|
From 9024078c32dd74ba0e376d422cba33f587f7756d Mon Sep 17 00:00:00 2001
|
2013-05-02 20:54:52 +00:00
|
|
|
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
|
Date: Sun, 10 Mar 2013 19:19:21 +0100
|
2013-06-12 19:24:37 +00:00
|
|
|
Subject: [PATCH 205/482] * include/grub/datetime.h
|
2013-05-02 20:54:52 +00:00
|
|
|
(grub_datetime2unixtime): Fix unixtime computation for some years
|
|
|
|
before epoch. Avode confusing division while on it.
|
|
|
|
|
|
|
|
---
|
|
|
|
ChangeLog | 6 ++++++
|
|
|
|
include/grub/datetime.h | 4 +---
|
|
|
|
2 files changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/ChangeLog b/ChangeLog
|
|
|
|
index 48ca30e..8814c22 100644
|
|
|
|
--- a/ChangeLog
|
|
|
|
+++ b/ChangeLog
|
|
|
|
@@ -1,5 +1,11 @@
|
|
|
|
2013-03-10 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
|
|
|
|
|
+ * include/grub/datetime.h (grub_datetime2unixtime): Fix unixtime
|
|
|
|
+ computation for some years before epoch. Avode confusing division
|
|
|
|
+ while on it.
|
|
|
|
+
|
|
|
|
+2013-03-10 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
|
+
|
|
|
|
* grub-core/video/i386/pc/vbe.c
|
|
|
|
(grub_video_vbe_print_adapter_specific_info): Replace division by
|
|
|
|
shifts.
|
|
|
|
diff --git a/include/grub/datetime.h b/include/grub/datetime.h
|
|
|
|
index 3a3b3d0..fef2814 100644
|
|
|
|
--- a/include/grub/datetime.h
|
|
|
|
+++ b/include/grub/datetime.h
|
|
|
|
@@ -89,9 +89,7 @@ grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix)
|
|
|
|
ret = 3 * SECPERYEAR + SECPERDAY;
|
|
|
|
|
|
|
|
/* Transform C divisions and modulos to mathematical ones */
|
|
|
|
- y4 = (datetime->year - 1973) / 4;
|
|
|
|
- if (datetime->year < 1973)
|
|
|
|
- y4--;
|
|
|
|
+ y4 = ((datetime->year - 1) >> 2) - (1973 / 4);
|
|
|
|
ay = datetime->year - 1973 - 4 * y4;
|
|
|
|
ret += y4 * SECPER4YEARS;
|
|
|
|
ret += ay * SECPERYEAR;
|
|
|
|
--
|
2013-06-07 18:03:56 +00:00
|
|
|
1.8.2.1
|
2013-05-02 20:54:52 +00:00
|
|
|
|