mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-29 10:39:22 +00:00
* include/grub/datetime.h (grub_datetime2unixtime): Fix offset.
This commit is contained in:
1 parent
b4bf7c3b20
commit
b1ac4cb1f9
2 files changed
+9
-5
No files matched your search
@@ -85,14 +85,14 @@ grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix)
|
||||
/* In the period of validity of unixtime all years divisible by 4
|
||||
are bissextile*/
|
||||
/* Convenience: let's have 3 consecutive non-bissextile years
|
||||
at the beginning of the epoch. So count from 1971 instead of 1970 */
|
||||
ret = 2 * SECPERYEAR + SECPERDAY;
|
||||
at the beginning of the epoch. So count from 1973 instead of 1970 */
|
||||
ret = 3 * SECPERYEAR + SECPERDAY;
|
||||
|
||||
/* Transform C divisions and modulos to mathematical ones */
|
||||
y4 = (datetime->year - 1972) / 4;
|
||||
if (datetime->year < 1972)
|
||||
y4 = (datetime->year - 1973) / 4;
|
||||
if (datetime->year < 1973)
|
||||
y4--;
|
||||
ay = datetime->year - 1972 - 4 * y4;
|
||||
ay = datetime->year - 1973 - 4 * y4;
|
||||
ret += y4 * SECPER4YEARS;
|
||||
ret += ay * SECPERYEAR;
|
||||
|
||||
|
||||
Reference in new issue
Block a user