Module Name: src
Committed By: kre
Date: Wed Mar 22 00:59:06 UTC 2017
Modified Files:
src/lib/libutil: parsedate.y
Log Message:
Fix PR lib/52101 -- 12:30 am is 00:30:00 and 12:30 pm is 12:30:00
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libutil/parsedate.y
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libutil/parsedate.y
diff -u src/lib/libutil/parsedate.y:1.29 src/lib/libutil/parsedate.y:1.30
--- src/lib/libutil/parsedate.y:1.29 Sun Jun 26 07:09:24 2016
+++ src/lib/libutil/parsedate.y Wed Mar 22 00:59:06 2017
@@ -14,7 +14,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: parsedate.y,v 1.29 2016/06/26 07:09:24 kre Exp $");
+__RCSID("$NetBSD: parsedate.y,v 1.30 2017/03/22 00:59:06 kre Exp $");
#endif
#include <stdio.h>
@@ -654,7 +654,9 @@ Convert(
tm.tm_sec = Seconds;
tm.tm_min = Minutes;
- tm.tm_hour = Hours + (Meridian == MERpm ? 12 : 0);
+ tm.tm_hour = ((Hours == 12 && Meridian != MER24) ? 0 : Hours) +
+ (Meridian == MERpm ? 12 : 0);
+
tm.tm_mday = Day;
tm.tm_mon = Month - 1;
tm.tm_year = Year - 1900;