diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-08-30 19:56:09 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2011-08-30 19:56:09 +0000 |
commit | 66b9d80cc59d22a289b0aa9c5a51ca77635f9b9e (patch) | |
tree | 78fe8a6b2b8aaa0b1aef764cb09fc113105a79fa /usr.bin | |
parent | 5890ba4d615bea7fb57ad28f75f439377bb120d9 (diff) |
Same fix as 'touch': with the -t option, when the year is specified
but the century isn't, the century is 1900 if year >= 69; otherwise
it's 2000. (With 32bit time_t, this does't affect any working usage.)
ok millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/at/at.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c index 287585e4870..88541d7dac8 100644 --- a/usr.bin/at/at.c +++ b/usr.bin/at/at.c @@ -1,4 +1,4 @@ -/* $OpenBSD: at.c,v 1.59 2011/08/23 15:06:37 millert Exp $ */ +/* $OpenBSD: at.c,v 1.60 2011/08/30 19:56:08 guenther Exp $ */ /* * at.c : Put file into atrun queue @@ -831,10 +831,11 @@ ttime(char *arg) yearset = ATOI2(arg); lt->tm_year += yearset; } else { - /* current century + specified year */ yearset = ATOI2(arg); - lt->tm_year = ((lt->tm_year / 100) * 100); - lt->tm_year += yearset; + /* POSIX logic: [00,68]=>20xx, [69,99]=>19xx */ + lt->tm_year = yearset; + if (yearset < 69) + lt->tm_year += 100; } /* FALLTHROUGH */ case 8: /* MMDDhhmm */ |