mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-29 02:31:05 +00:00
* include/grub/datetime.h (grub_datetime2unixtime): Fix unixtime
computation for some years before epoch. Avode confusing division while on it.
This commit is contained in:
1 parent
21344ef620
commit
84cfe81b1d
2 files changed
+7
-3
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user