Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libutil Fix PR lib/52101 -- 12:30 am is 00:30:00 and 12:...



details:   https://anonhg.NetBSD.org/src/rev/ac250d8f08b4
branches:  trunk
changeset: 822477:ac250d8f08b4
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Mar 22 00:59:06 2017 +0000

description:
Fix PR lib/52101 -- 12:30 am is 00:30:00 and 12:30 pm is 12:30:00

diffstat:

 lib/libutil/parsedate.y |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r e74b1183da29 -r ac250d8f08b4 lib/libutil/parsedate.y
--- a/lib/libutil/parsedate.y   Tue Mar 21 22:52:10 2017 +0000
+++ b/lib/libutil/parsedate.y   Wed Mar 22 00:59:06 2017 +0000
@@ -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 @@
 
     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;



Home | Main Index | Thread Index | Old Index