* include/grub/datetime.h (grub_datetime2unixtime): Fix off-by-one
error.
This commit is contained in:
parent
5587329c91
commit
186b402804
2 changed files with 10 additions and 5 deletions
|
@ -1,4 +1,9 @@
|
||||||
2011-10-25 Vladimir Serbinenko <phcoder@gmail.com>
|
2011-10-26 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/datetime.h (grub_datetime2unixtime): Fix off-by-one
|
||||||
|
error.
|
||||||
|
|
||||||
|
2011-10-26 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
ZFS fixes.
|
ZFS fixes.
|
||||||
|
|
||||||
|
|
|
@ -86,13 +86,13 @@ grub_datetime2unixtime (const struct grub_datetime *datetime, grub_int32_t *nix)
|
||||||
are bissextile*/
|
are bissextile*/
|
||||||
/* Convenience: let's have 3 consecutive non-bissextile years
|
/* Convenience: let's have 3 consecutive non-bissextile years
|
||||||
at the beginning of the epoch. So count from 1971 instead of 1970 */
|
at the beginning of the epoch. So count from 1971 instead of 1970 */
|
||||||
ret = SECPERYEAR + SECPERDAY;
|
ret = 2 * SECPERYEAR + SECPERDAY;
|
||||||
|
|
||||||
/* Transform C divisions and modulos to mathematical ones */
|
/* Transform C divisions and modulos to mathematical ones */
|
||||||
y4 = (datetime->year - 1971) / 4;
|
y4 = (datetime->year - 1972) / 4;
|
||||||
if (datetime->year < 1971)
|
if (datetime->year < 1972)
|
||||||
y4--;
|
y4--;
|
||||||
ay = datetime->year - 1971 - 4 * y4;
|
ay = datetime->year - 1972 - 4 * y4;
|
||||||
ret += y4 * SECPER4YEARS;
|
ret += y4 * SECPER4YEARS;
|
||||||
ret += ay * SECPERYEAR;
|
ret += ay * SECPERYEAR;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue