Re: adjtime without 3rd line: RTC is local or UTC?

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

 



On 21 February 2011 09:45, Karel Zak <kzak@xxxxxxxxxx> wrote:
>  The problem is backward compatibility. People who depend on the
>  current hwclock default will hate us :-)

There will be some impact, but I don't think it will be significant.
Anyone who has run hwclock at some time in the past will already have
their choice of UTC or LOCAL stored in /etc/adjtime, so changing the
default won't affect them.

I've attached a patch which switches hwclock's default to UTC without
any backwards-compat considerations, but if you still feel uneasy, let
me know and I'll produce a configure-based one instead.

Thanks,
Daniel
From a09091f19c38a82b9a39b43ebded1f9c66fabea4 Mon Sep 17 00:00:00 2001
From: Daniel Drake <dsd@xxxxxxxxxx>
Date: Mon, 21 Feb 2011 13:27:07 +0000
Subject: [PATCH] hwclock: make RTC default to UTC time

If /etc/adjtime doesn't specify UTC or LOCAL, rtcwake defaults to UTC
and hwclock defaults to LOCAL.

Switch hwclock to meet the behaviour of rtcwake (default=UTC), also
matching the kernel's CONFIG_RTC_HCTOSYS behaviour.

The user impact of this change should be minimal, as anyone who has run
"hwclock --systohc" before will have their UTC/LOCAL choice already
recorded in /etc/adjtime.

Signed-off-by: Daniel Drake <dsd@xxxxxxxxxx>
---
 hwclock/hwclock.8 |    2 +-
 hwclock/hwclock.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hwclock/hwclock.8 b/hwclock/hwclock.8
index 31f7692..b693ae2 100644
--- a/hwclock/hwclock.8
+++ b/hwclock/hwclock.8
@@ -169,7 +169,7 @@ was used to set the clock (i.e. hwclock was successfully run with the
 or
 .B \-\-adjust
 options), as recorded in the adjtime file.  If the adjtime file doesn't
-exist, the default is local time.
+exist, the default is UTC time.
 
 .TP
 .B \-\-noadjfile
diff --git a/hwclock/hwclock.c b/hwclock/hwclock.c
index 279b672..88fb8a0 100644
--- a/hwclock/hwclock.c
+++ b/hwclock/hwclock.c
@@ -224,8 +224,8 @@ hw_clock_is_utc(const bool utc, const bool local_opt,
 	else if (local_opt)
 		ret = FALSE;	/* --localtime explicitly given */
 	else
-				/* get info from adjtime file - default is local */
-		ret = (adjtime.local_utc == UTC);
+				/* get info from adjtime file - default is UTC */
+		ret = (adjtime.local_utc != LOCAL);
 	if (debug)
 		printf(_("Assuming hardware clock is kept in %s time.\n"),
 		       ret ? _("UTC") : _("local"));
-- 
1.7.4


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux