You are not logged in.

#26 2011-05-15 00:31:23

Jelle
Member
From: Netherlands
Registered: 2011-01-30
Posts: 84

Re: Clock wrong

I have the same issue: I run Ubuntu, Crunchbang and Arch, although I rarely use the first two. Setting the clock to localtime in /etc/rc.conf solves it for me.

Offline

#27 2011-05-15 01:54:00

jlacroix
Member
Registered: 2009-08-16
Posts: 576

Re: Clock wrong

It's the same for me, except that I do not use any other distro or OS on this laptop (though with petty issues like this I'm considering it).

Offline

#28 2011-05-15 04:47:33

tdreyer1
Member
From: US
Registered: 2011-03-26
Posts: 13
Website

Re: Clock wrong

Same issue here. Setting everything back to localtime solves the problem for me.

Offline

#29 2011-06-02 23:54:10

ringer
Member
Registered: 2011-06-02
Posts: 5

Re: Clock wrong

I am having the same problem with the clock showing four hours behind (I am in the UK and the clock is showing Atlantic time).
I logged on at 22:04:37 local time

/var/log/dmesg.log

...
rtc_cmos 00:07: setting system clock to 2011-06-02 18:04:37 UTC (1307037877)
...

/etc/rc.conf

# /etc/rc.conf - Main Configuration for Arch Linux
...
LOCALE="en_GB.utf8"
HARDWARECLOCK="UTC"
USEDIRECTISA="no"
TIMEZONE="Europe/London"
KEYMAP="uk"
CONSOLEFONT=
CONSOLEMAP=
USECOLOR="yes"
... 

so it would appear I have set to UTC rather than localtime
now, rc.sysinit runs rc.conf then checks the value of HARDWARECLOCK and acts accordingly

#!/bin/bash
#
# /etc/rc.sysinit
#

. /etc/rc.conf
. /etc/rc.d/functions
...
HWCLOCK_PARAMS="--hctosys"
if [ "$HARDWARECLOCK" = "UTC" ]; then
    HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
elif [ "$HARDWARECLOCK" = "localtime" ]; then
    HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
else
    HWCLOCK_PARAMS=""
fi

if [ -n "$HWCLOCK_PARAMS" ]; then
    # enable rtc access
    /sbin/modprobe -q rtc-cmos
    # some custom kernels use rtc/genrtc, try to load those too
    /sbin/modprobe -q rtc
    /sbin/modprobe -q genrtc
    # If devtmpfs is used, the required RTC device already exists now
    # Otherwise, create whatever device is available
    if [ ! -c /dev/rtc -a ! -c /dev/rtc0 ]; then
        if [ -f /sys/class/rtc/rtc0/dev ]; then
            IFS=: read -r major minor < /sys/class/rtc/rtc0/dev
            /bin/mknod /dev/rtc0 c $major $minor
        elif [ -f /sys/class/misc/rtc/dev ]; then
            IFS=: read -r major minor < /sys/class/misc/rtc/dev
            /bin/mknod /dev/rtc c $major $minor
        fi
    fi

    # Do a clock set here for a few reasons:
    # 1. Make creation time on udev nodes sane (FS#8665)
    # 2. Filesystem checks can depend on system time
    # 3. This will set the clock, if using non-UTC, off the last known
    #    configured timezone. Any new timezone put in rc.conf is copied over at
    #    a later time.
    # This does *NOT* take into account a time adjustment file as /var may not be
    # mounted yet. A second set occurs later to match rc.conf.
    if [ -f /etc/localtime ]; then
        /sbin/hwclock $HWCLOCK_PARAMS --noadjfile
    fi
fi
...

echo $HARDWARECLOCK
gives nothing  because the variable was either not set, or was set and then later unset

and looking in /sys/devices/pnp0/00:07/rtc/rtc0/time shows the current system time, which is displayed on my clock, because this file provides data direct from the onboard (clock) device

Don't know if this is relevant, but noticed in /etc/rc.d/functions (which is also run by /etc/rc.sysinit)

...
# clear the TZ envvar, so daemons always respect /etc/localtime
unset TZ
...

so perhaps there are other scripts that are run that unset the relevant variables, so the system reverts to the rtc_cmos as instructed in the rc.sysinit script above

sad confused

Offline

#30 2011-06-03 04:20:10

smudge
Member
Registered: 2011-03-20
Posts: 158

Re: Clock wrong

ringer wrote:

/var/log/dmesg.log

...
rtc_cmos 00:07: setting system clock to 2011-06-02 18:04:37 UTC (1307037877)
...

I'm thinking this means your rtc_cmos clock is set to the wrong time. Try, as root, setting the date/time with:

 date  060322392011.00 

(that's MMDDhhmmYYYY.ss)

Type date again to check it's correct then try:

 hwclock --show 

I'm guessing that will show you the wrong time so then try:

 hwclock --systohc 

Both date and hwclock --show should now give you the right time.

HTH smile

This may help jlacroix too.

Offline

#31 2011-07-25 18:14:59

scjet
Banned
Registered: 2011-07-23
Posts: 172

Re: Clock wrong

... same as others, when BIOS is set to right time, and I select "locatime" in Arch, all is well (+ right Timezone,....).
but "UTC" gives the wrong time ALL the time ?


The "BSD" things in life are "Free", and "Open", and so is "Arch"

Offline

#32 2011-07-25 20:31:19

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

Re: Clock wrong

I ended up using this page to sort out my clock:  https://wiki.archlinux.org/index.php/NTP   (OpenNtpd is no longer maintained)

Admittedly it may be overkill and I did not set up my desktop as a time-server for my LAN.  OTOH, it works and I don't worry about my clock being off by an hour or two.

Offline

#33 2011-11-13 04:54:04

solar
Member
Registered: 2011-03-01
Posts: 77

Re: Clock wrong

1LordAnubis wrote:
Inxsible wrote:

You should read the wiki more carefully :

Beginner's Guide wrote:

HARDWARECLOCK
    Specifies whether the hardware clock, which is synchronized on boot and on shutdown, stores UTC time, or localtime. UTC makes sense because it greatly simplifies changing timezones and daylight savings time. localtime is necessary if you dual boot with an operating system such as Windows, that only stores localtime to the hardware clock.

Well, for me localtime is necessary for my hwclock b/c I have an external lcd i use for looking at the time (for ex, if i'm playing a movie fullscreen); should i really set it to utc, or disable it in the bios b/c its discouraged?
Sorry I have to be the person with an external clock pasted to their laptop

( http://lordanubis.netau.net/files/desks … dthumb.JPG)

OH MY GAWWWD, you seem to be a student but mein gottling.. how old is that mouse (and laptop) tongue Intellimouse from 2001 or something? tongue

On a side-note. Ye the time archwiki is inacurate and the scripts not great. Makes us spend endless time and always getting the wrong time.

As others say, localtime seem to fix it (I didn't try *DUE TO* the warning of not doing it, but guess I will) sigh. doesn't make sense though.
EDIT: Also, thanks for link from someone, points out systemd doesn't support localtime, which is what I am running now (systemd).

Anyway, this is frakking dope but seems doing the below and spending the time to set it up 'securely?' is the fix.

Anyway , else it is ntp as another one said, although a tad overkill.

Last edited by solar (2011-11-13 05:04:55)


I am hilariously insane. yup. you won't notice though.. I promise...I think.

Offline

#34 2011-11-13 09:41:42

tyo
Member
From: Leipzig, Germany
Registered: 2011-10-29
Posts: 7

Re: Clock wrong

Just an idea: if we set HARDWARECLOCK to "UTC", my assumption would be that the system treats the BIOS time as UTC and then calculates the right time from the Time Zone setting, and also takes into account the daylight savings time. This is the case for my system, at least: the BIOS clock needs to be set to UTC time.

However, this doesn't explain why people from the UK are four hours off…

Last edited by tyo (2011-11-13 09:44:19)

Offline

Board footer

Powered by FluxBB