From: Joseph Parmelee <jparmele@wildbear.com>
To: util-linux@vger.kernel.org
Subject: PATCH Make hwclock leap-second-aware
Date: Sun, 17 Mar 2013 22:48:57 -0600 (CST) [thread overview]
Message-ID: <alpine.LNX.2.00.1303172227410.3487@bruno> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 831 bytes --]
Hello:
Attached is a patch file leap_seconds.patch against util-linux-2.22.2
that allows leap seconds to be included in hwclock --show or --hctosys.
The current code uses the default UTC zonefile in reading the hardware
RTC with mktime(). This zonefile usually does not include leap
seconds. As of this date there have been a total of 25 leap seconds
added since the epoch (start of 1970). This is particularly a problem
for systems using ntp to maintain their system clocks because ntp does
take leap seconds into account. A user can specify a leap-second-aware
zonefile via /etc/localtime. By defining the environment variable
TZUTC, mktime() can be induced to use a matching UTC zonefile that
includes leap seconds. The default behavior (TZUTC undefined) is
unchanged.
Regards,
Joseph Parmelee
jparmele at wildbear.com
[-- Attachment #2: Leap seconds patch for hwclock --]
[-- Type: TEXT/PLAIN, Size: 843 bytes --]
--- sys-utils/hwclock.c.orig 2012-12-12 14:04:22.976355744 -0600
+++ sys-utils/hwclock.c 2013-03-16 18:57:48.774606768 -0600
@@ -382,8 +382,15 @@
*/
zone = getenv("TZ"); /* remember original time zone */
if (universal) {
- /* Set timezone to UTC */
- setenv("TZ", "", TRUE);
+ /* Set timezone to UTC as defined by the environment
+ * variable TZUTC. TZUTC undefined gives the default UTC
+ * zonefile which usually does not take into account leap
+ * seconds. Define TZUTC to select your UTC zonefile which
+ * does include leap seconds. For example, with recent GNU
+ * libc's:
+ * TZUTC=:/usr/share/zoneinfo/right/UTC
+ */
+ setenv("TZ", getenv("TZUTC"), TRUE);
/*
* Note: tzset() gets called implicitly by the time code,
* but only the first time. When changing the environment
next reply other threads:[~2013-03-18 4:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 4:48 Joseph Parmelee [this message]
2013-03-18 9:48 ` PATCH Make hwclock leap-second-aware Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.00.1303172227410.3487@bruno \
--to=jparmele@wildbear.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox