diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-01-02 11:53:59 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-01-02 11:53:59 +0000 |
commit | 6f8a487bea2e9e449012f0edaca247a7249ab1e9 (patch) | |
tree | a3815c7f218f704999ba28275601d6343dc4641f /usr.bin/at/parsetime.c | |
parent | c8703620b278cf482d82f4f83969bebaf0f0e265 (diff) |
got am/pm reversed when hour is 12; from Mark_Weaver@brown.edu; netbsd pr#1743
Diffstat (limited to 'usr.bin/at/parsetime.c')
-rw-r--r-- | usr.bin/at/parsetime.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c index 3f4e0234b5e..6a5f796ebc9 100644 --- a/usr.bin/at/parsetime.c +++ b/usr.bin/at/parsetime.c @@ -349,22 +349,23 @@ tod(tm) if (token() == DOT) { expect(NUMBER); minute = atoi(sc_token); - if (minute > 59) - panic("garbled time"); token(); } else if (tlen == 4) { minute = hour%100; - if (minute > 59) - panic("garbeld time"); hour = hour/100; } + if (minute > 59) + panic("garbled time"); + /* * check if an AM or PM specifier was given */ if (sc_tokid == AM || sc_tokid == PM) { if (hour > 12) panic("garbled time"); + else if (hour == 12) + hour = 0; if (sc_tokid == PM) hour += 12; @@ -382,10 +383,6 @@ tod(tm) tm->tm_hour = hour; tm->tm_min = minute; - if (tm->tm_hour == 24) { - tm->tm_hour = 0; - tm->tm_mday++; - } } /* tod */ |