NetBSD Problem Report #1743
From gnats Wed Nov 8 20:50:16 1995
Received: from peace.netspace.org by pain.lcs.mit.edu (8.6.9/8.6.9) with ESMTP id UAA28832 for <gnats-bugs@gnats.netbsd.org>; Wed, 8 Nov 1995 20:42:28 -0500
Message-Id: <199511082330.SAA02976@peace.netspace.org>
Date: Wed, 8 Nov 1995 18:30:32 -0500
From: Mark_Weaver@brown.edu
Reply-To: Mark_Weaver@brown.edu
To: gnats-bugs@gnats.netbsd.org
Subject: at(1) gets am/pm reversed when hour is 12
X-Send-Pr-Version: 3.2
>Number: 1743
>Category: bin
>Synopsis: at(1) gets am/pm reversed when hour is 12
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: jtc
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 08 21:05:00 +0000 1995
>Closed-Date: Fri Jul 18 01:10:03 +0000 1997
>Last-Modified: Sun Jun 01 18:58:59 +0000 2014
>Originator: Mark Weaver
>Release: NetBSD-current 11/6/95
>Organization:
Brown University Department of Computer Science
>Environment:
NetBSD peace.netspace.org 1.1_ALPHA NetBSD 1.1_ALPHA (WEAVER) #0: Wed Nov 1 16:34:36 EST 1995 mhw@peace.netspace.org:/usr/src/sys/arch/i386/compile/WEAVER i386
>Description:
at(1) get am and pm reversed when the hour is 12. `at 12am` will go
at noon and `at 12pm` at midnight.
>How-To-Repeat:
at 12am
atq
at 12pm
atq
>Fix:
diff -c src/usr.bin/at/parsetime.c.mhw1 src/usr.bin/at/parsetime.c
*** src/usr.bin/at/parsetime.c.mhw1 Fri Oct 13 23:01:11 1995
--- src/usr.bin/at/parsetime.c Wed Nov 8 02:12:52 1995
***************
*** 349,370 ****
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;
}
/*
* check if an AM or PM specifier was given
*/
if (sc_tokid == AM || sc_tokid == PM) {
if (hour > 12)
panic("garbled time");
if (sc_tokid == PM)
hour += 12;
--- 349,371 ----
if (token() == DOT) {
expect(NUMBER);
minute = atoi(sc_token);
token();
} else if (tlen == 4) {
minute = hour%100;
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,391 ****
tm->tm_hour = hour;
tm->tm_min = minute;
- if (tm->tm_hour == 24) {
- tm->tm_hour = 0;
- tm->tm_mday++;
- }
} /* tod */
--- 383,388 ----
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->jtc
Responsible-Changed-By: jtc
Responsible-Changed-When: Tue Feb 20 03:37:17 1996
Responsible-Changed-Why:
I'm currently working on major changes to at.
State-Changed-From-To: open->closed
State-Changed-By: phil
State-Changed-When: Thu Jul 17 18:10:03 PDT 1997
State-Changed-Why:
Patch applied. We might as well have at know proper times
while we wait for further changes.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.