[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
standards/121921: [patch] Add leap second support to at(1), atrun(8)
- To: FreeBSD-gnats-submit_(_at_)_FreeBSD_(_dot_)_org
- Subject: standards/121921: [patch] Add leap second support to at(1), atrun(8)
- From: "Frank W. Josellis" <frank_(_at_)_dynamical-systems_(_dot_)_org>
- Date: Thu, 20 Mar 2008 18:50:30 +0100 (CET)
- Cc:
- Resent-date: Thu, 20 Mar 2008 18:00:02 GMT
- Resent-from: FreeBSD-gnats-submit_(_at_)_FreeBSD_(_dot_)_org (GNATS Filer)
- Resent-message-id: <200803201800_(_dot_)_m2KI02aG013757_(_at_)_freefall_(_dot_)_freebsd_(_dot_)_org>
- Resent-reply-to: FreeBSD-gnats-submit_(_at_)_FreeBSD_(_dot_)_org, "Frank W. Josellis" <frank_(_at_)_dynamical-systems_(_dot_)_org>
- Resent-to: freebsd-standards_(_at_)_FreeBSD_(_dot_)_org
>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_(_at_)_pollux_(_dot_)_senax_(_dot_)_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:
_______________________________________________
freebsd-standards_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-standards
To unsubscribe, send any mail to "freebsd-standards-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org