Web lists-archives.com

Re: Correct: System Thinks Hardware Clock is UTC




Patrick Bartek wrote:
>On Fri, 18 May 2018 20:59:25 -0500 David Wright
><deblis@xxxxxxxxxxxxxxxxx> wrote:
>
>> On Fri 18 May 2018 at 17:13:07 (-0700), Patrick Bartek wrote:
>> > Okay, it's my fault: I admit it. During the Base Only, Terminal-only
>> > install of Stretch, I clicked UTC instead of Local for the hardware
>> > clock time. Honestly, I thought the clock was set to UTC. Haven't
>> > installed any other OS on this system since Wheezy 5 years ago. So,
>> > now system time on Stretch is 7 hours earlier than it should be --
>> > difference between my time zone and Greenwich.
>> 
>> You could reboot and set the hardware clock in the CMOS/BIOS
>> to UTC time (coming up to 02:00 Saturday as I send this).
>
>Unfortunately, I have other OSes on this system and they are configured
>for the hardware clock set to local time. I need to keep it that way.
>
>Thanks, anyway.

The code in the Debian installer that deals with this [1] is:

---------------------------------------
# Update target system configuration for utc/localtime selection
utcfile=/target/etc/default/rcS

db_get clock-setup/utc
if [ "$RET" = true ]; then
        if [ -e $utcfile ]; then
                sed -i -e 's:^UTC="no":UTC="yes":' -e 's:^UTC=no:UTC=yes:' $utcfile
        fi
        if [ -e /target/etc/adjtime ]; then
                sed -i -e 's:^LOCAL$:UTC:' /target/etc/adjtime
        fi
        OPT="--utc"
else
        if [ -e $utcfile ]; then
                sed -i -e 's:^UTC="yes":UTC="no":' -e 's:^UTC=yes:UTC=no:' $utcfile
        fi
        if [ -e /target/etc/adjtime ]; then
                sed -i -e 's:^UTC$:LOCAL:' /target/etc/adjtime
        fi
        OPT="--localtime"
fi
---------------------------------------

If you're using systemd, then /etc/default/rcS is not likely to do
much. However, you may want to check in /etc/adjtime. My machine has
the following:

0.000000 1521991744 0.000000
1521991744
UTC

If yours is saying "UTC" there, then try "LOCAL" instead.

HTH!

[1] https://salsa.debian.org/installer-team/clock-setup/blob/master/finish-install.d/10clock-setup#L118

-- 
Steve McIntyre, Cambridge, UK.                                steve@xxxxxxxxxx
"Further comment on how I feel about IBM will appear once I've worked out
 whether they're being malicious or incompetent. Capital letters are forecast."
 Matthew Garrett, http://www.livejournal.com/users/mjg59/30675.html