mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
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.
This commit is contained in:
parent
de88f1607c
commit
9b2ea11c98
1 changed files with 8 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue