summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-03-06 04:57:01 +0000
committerJim Meyering <jim@meyering.net>1996-03-06 04:57:01 +0000
commitaaa9cb7c227451496651271125cdf92646e1ce7f (patch)
treeb3a0f3c75c3062357e268828786fc481bb59c63a /lib
parent73d802bead7e8042bb67dc0839767b3d853583c9 (diff)
downloadcoreutils-aaa9cb7c227451496651271125cdf92646e1ce7f.tar.xz
(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).
Diffstat (limited to 'lib')
-rw-r--r--lib/getdate.y6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/getdate.y b/lib/getdate.y
index ce119056a..a1b8ee80d 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -682,7 +682,7 @@ RelativeMonth (Start, RelMonth)
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 @@ LookupWord (buff)
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 @@ get_date (p, now)
if (! (tm = localtime (&ftz.time)))
return -1;
-
+
ftz.timezone = difftm (&gmt, tm) / 60;
if (tm->tm_isdst)
ftz.timezone += 60;