Mercurial > gnulib
changeset 20252:786d8aafa8c8
(RelativeMonth): Add 1900 to the year so that relative date specs
that push the year through the end of the century work. For example,
`date -d "01/01/1998 3 years" +%Y' now prints 2001.
From Peter Dalgaard (pd@kubism.ku.dk).
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Wed, 06 Mar 1996 04:57:01 +0000 |
parents | 882a821a683f |
children | 3c56f55aa7e7 |
files | lib/getdate.y |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/getdate.y Thu Feb 29 02:27:43 1996 +0000 +++ b/lib/getdate.y Wed Mar 06 04:57:01 1996 +0000 @@ -682,7 +682,7 @@ if (RelMonth == 0) return 0; tm = localtime (&Start); - Month = 12 * tm->tm_year + tm->tm_mon + RelMonth; + Month = 12 * (1900 + tm->tm_year) + tm->tm_mon + RelMonth; Year = Month / 12; Month = Month % 12 + 1; return DSTcorrect (Start, @@ -745,7 +745,7 @@ return tp->type; } - if (strcmp (buff, "dst") == 0) + if (strcmp (buff, "dst") == 0) return tDST; for (tp = UnitsTable; tp->name; tp++) @@ -896,7 +896,7 @@ if (! (tm = localtime (&ftz.time))) return -1; - + ftz.timezone = difftm (&gmt, tm) / 60; if (tm->tm_isdst) ftz.timezone += 60;