diff options
author | jdp <jdp@FreeBSD.org> | 1996-07-19 00:44:55 +0000 |
---|---|---|
committer | jdp <jdp@FreeBSD.org> | 1996-07-19 00:44:55 +0000 |
commit | 699492bba810a111d8bd13562f40f04127c345e5 (patch) | |
tree | 2de9a6320c1af67aa71bb1ec85add8289b471804 /usr.bin/at | |
parent | 07c6f9532c5ffbdab705fa8517d5f1182924f4de (diff) | |
download | FreeBSD-src-699492bba810a111d8bd13562f40f04127c345e5.zip FreeBSD-src-699492bba810a111d8bd13562f40f04127c345e5.tar.gz |
Fix botches in the handling of "AM" and "PM":
12:xx PM is 12:xx, not 24:xx.
12:xx AM is 00:xx, not 12:xx.
Diffstat (limited to 'usr.bin/at')
-rw-r--r-- | usr.bin/at/parsetime.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c index a54e7f0..50c7137 100644 --- a/usr.bin/at/parsetime.c +++ b/usr.bin/at/parsetime.c @@ -130,7 +130,7 @@ static size_t sc_len; /* scanner - lenght of token buffer */ static int sc_tokid; /* scanner - token id */ static int sc_tokplur; /* scanner - is token plural? */ -static char rcsid[] = "$Id: parsetime.c,v 1.1 1995/05/24 15:07:32 ig25 Exp $"; +static char rcsid[] = "$Id: parsetime.c,v 1.6 1995/08/21 12:32:50 ache Exp $"; /* Local functions */ @@ -367,8 +367,13 @@ tod(struct tm *tm) if (hour > 12) panic("garbled time"); - if (sc_tokid == PM) - hour += 12; + if (sc_tokid == PM) { + if (hour != 12) /* 12:xx PM is 12:xx, not 24:xx */ + hour += 12; + } else { + if (hour == 12) /* 12:xx AM is 00:xx, not 12:xx */ + hour -= 12; + } token(); } else if (hour > 23) |