From owner-freebsd-standards@FreeBSD.ORG Thu Mar 20 18:00:02 2008 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B26B11065678 for ; Thu, 20 Mar 2008 18:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8CE488FC1E for ; Thu, 20 Mar 2008 18:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m2KI02Vv013758 for ; Thu, 20 Mar 2008 18:00:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m2KI02aG013757; Thu, 20 Mar 2008 18:00:02 GMT (envelope-from gnats) Resent-Date: Thu, 20 Mar 2008 18:00:02 GMT Resent-Message-Id: <200803201800.m2KI02aG013757@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Frank W. Josellis" Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07A501065753 for ; Thu, 20 Mar 2008 17:50:35 +0000 (UTC) (envelope-from frank@dynamical-systems.org) Received: from mout1.freenet.de (mout1.freenet.de [IPv6:2001:748:100:40::2:3]) by mx1.freebsd.org (Postfix) with ESMTP id 68CCA8FC14 for ; Thu, 20 Mar 2008 17:50:34 +0000 (UTC) (envelope-from frank@dynamical-systems.org) Received: from [195.4.92.23] (helo=13.mx.freenet.de) by mout1.freenet.de with esmtpa (Exim 4.69) (envelope-from ) id 1JcOuO-0000tB-VQ for FreeBSD-gnats-submit@freebsd.org; Thu, 20 Mar 2008 18:50:32 +0100 Received: from p508e89f0.dip0.t-ipconnect.de ([80.142.137.240]:64606 helo=pollux.senax.net) by 13.mx.freenet.de with esmtpsa (ID jr-relay@freenet.de) (TLSv1:AES256-SHA:256) (port 25) (Exim 4.69 #12) id 1JcOuO-0005mP-GD for FreeBSD-gnats-submit@freebsd.org; Thu, 20 Mar 2008 18:50:32 +0100 Received: from pollux.senax.net (localhost.senax.net [127.0.0.1]) by pollux.senax.net (8.13.6/8.13.6) with ESMTP id m2KHoUNL002146; Thu, 20 Mar 2008 18:50:30 +0100 (CET) (envelope-from frank@dynamical-systems.org) Received: (from josellis@localhost) by pollux.senax.net (8.13.6/8.13.6/Submit) id m2KHoUbw002145; Thu, 20 Mar 2008 18:50:30 +0100 (CET) (envelope-from frank@dynamical-systems.org) Message-Id: <200803201750.m2KHoUbw002145@pollux.senax.net> Date: Thu, 20 Mar 2008 18:50:30 +0100 (CET) From: "Frank W. Josellis" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: standards/121921: [patch] Add leap second support to at(1), atrun(8) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Mar 2008 18:00:02 -0000 >Number: 121921 >Category: standards >Synopsis: [patch] Add leap second support to at(1), atrun(8) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Mar 20 18:00:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Frank W. Josellis >Release: FreeBSD 5.5-STABLE i386 >Organization: >Environment: System: FreeBSD pollux.senax.net 5.5-STABLE FreeBSD 5.5-STABLE #21: Fri Feb 15 15:23:21 CET 2008 root@pollux.senax.net:/usr/obj/usr/src/sys/POLLUX i386 >Description: The at(1) and atrun(8) commands make use of a timestamp format which can be described as ``minutes since the Epoch''. For a given time_t variable t this value is determined by integer division t/60. Conversely, minutes are reverted to seconds by a factor 60. This is only suitable for a POSIX-style system time where every minute has exactly 60 seconds. On a system with support for true UTC this approach gives undesired side effects. However, this can easily be avoided by using the functionality of time2posix(3) and posix2time(3) as shown in the patch below. I don't see any reason why at/atrun should just support POSIX-style time. As a matter of fact, POSIX time is a poor concept which violates the standards of civil timekeeping. Nonetheless, a patch doesn't hurt on sytems where POSIX-style system time is mandatory. >How-To-Repeat: >Fix: --- at.patch begins here --- diff -Nur src.orig/libexec/atrun/atrun.c src/libexec/atrun/atrun.c --- src.orig/libexec/atrun/atrun.c 2007-06-15 14:01:53.000000000 +0200 +++ src/libexec/atrun/atrun.c 2008-03-20 16:32:55.000000000 +0100 @@ -526,7 +526,7 @@ if (sscanf(dirent->d_name,"%c%5lx%8lx",&queue,&jobno,&ctm) != 3) continue; - run_time = (time_t) ctm*60; + run_time = posix2time((time_t) ctm*60); if ((S_IXUSR & buf.st_mode) && (run_time <=now)) { if (isupper(queue) && (strcmp(batch_name,dirent->d_name) > 0)) { diff -Nur src.orig/usr.bin/at/at.c src/usr.bin/at/at.c --- src.orig/usr.bin/at/at.c 2007-09-21 03:54:48.000000000 +0200 +++ src/usr.bin/at/at.c 2008-03-20 16:32:55.000000000 +0100 @@ -265,7 +265,7 @@ perr("cannot generate job number"); sprintf(ppos, "%c%5lx%8lx", queue, - jobno, (unsigned long) (runtimer/60)); + jobno, (unsigned long) (time2posix(runtimer)/60)); for(ap=ppos; *ap != '\0'; ap ++) if (*ap == ' ') @@ -507,7 +507,7 @@ if (atqueue && (queue != atqueue)) continue; - runtimer = 60*(time_t) ctm; + runtimer = posix2time(60*(time_t) ctm); runtime = *localtime(&runtimer); strftime(timestr, TIMESIZE, "%+", &runtime); if (first) { --- at.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: