Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Time/TimeZone set

  1. #1

    Default Time/TimeZone set

    I just installed OpenSuse 11.2 3 months ago on my laptop. I'm running with the Gnome Desktop. I live in Chicago and am currently in London. When I set the timezone to Europe/UK the date/time are correct UNTIL I reboot the laptop. After reboot if I type in the 'date' command it shows the time at 6+ hours from London time. When I check the hardware clock 'hwclock' it displays the correct London time. I check the time setup with yast and it shows the correct Timezone but again shows the 6+ hours difference. I change the time in yast and and my applications ( e-mail) display the correct local time again... UNTIL I reboot and then I'm right back where I started - wrong local time ! I suppose I could write a little startup script to do a 'hwclock --hctosys' but I thought I'd check here first to see if anyone out there had any ideas..
    BTW - I hate to say this but on the same laptop running XP I don't have this problem AND I didn't see this problem in OpenSuse 10.3 or 11.1
    Thanks..
    Jim

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Time/TimeZone set

    When you shutdown the machine, the portion of /etc/init.d/boot.clock that writes the time back to the hardware clock is this:

    Code:
            if test "$ELEVENMIN_MODE" = yes ; then
                echo "The System Time is in sync with Hardware Clock ${stat}${done}good${norm}"
                rc_status
                rc_exit
            fi
            if test "$USE_HWCLOCK" = yes -a "$SYSTOHC" = yes ; then
                echo -n "Set Hardware Clock to the current System Time"
                #
                # Write system time back to hardware clock
                #
                if test "$USE_ADJFILE" = yes ; then
                    /sbin/hwclock --systohc $HWCLOCK
                else
                    # Remove any /etc/adjtime left over
                    test -e /etc/adjtime && rm -f /etc/adjtime
                    /sbin/hwclock --systohc $HWCLOCK --noadjfile
                fi
                rc_status -v
            fi
            ;;
    So you should watch the shutdown messages to see if it displays:

    Set Hardware Clock to the current System Time
    If not, then check your settings for USE_HWCLOCK and SYSTOHC in /etc/sysconfig/clock.

  3. #3
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,645

    Default Re: Time/TimeZone set

    Ok time is complicated.

    1) If you originally had the Hardware set to UTC (btw London or Greenwich time) then you had the OS told the HW clock was UTC not local so you should just need to change the timezone of the OS clock

    2) If you originally had the HW clock set to the local time and the OS was set to local. Changing the HW clock should do it.

    3) If you are dual booting then Windows figures in. Windows sets the HW clock to local time. So you must have the Linux clock set to use local. And be sure that the time zones are set right

    There is easily several more possibilities when you throw in time servers.

  4. #4

    Default Re: Time/TimeZone set

    Quote Originally Posted by ken_yap View Post
    When you shutdown the machine, the portion of /etc/init.d/boot.clock that writes the time back to the hardware clock is this:

    Code:
            if test "$ELEVENMIN_MODE" = yes ; then
                echo "The System Time is in sync with Hardware Clock ${stat}${done}good${norm}"
                rc_status
                rc_exit
            fi
            if test "$USE_HWCLOCK" = yes -a "$SYSTOHC" = yes ; then
                echo -n "Set Hardware Clock to the current System Time"
                #
                # Write system time back to hardware clock
                #
                if test "$USE_ADJFILE" = yes ; then
                    /sbin/hwclock --systohc $HWCLOCK
                else
                    # Remove any /etc/adjtime left over
                    test -e /etc/adjtime && rm -f /etc/adjtime
                    /sbin/hwclock --systohc $HWCLOCK --noadjfile
                fi
                rc_status -v
            fi
            ;;
    So you should watch the shutdown messages to see if it displays:



    If not, then check your settings for USE_HWCLOCK and SYSTOHC in /etc/sysconfig/clock.
    Well one thinks for sure ... boot.clock isn't working correctly ...

    # date
    Sat Feb 27 01:34:17 GMT 2010

    # hwclock
    Fri Feb 26 19:34:29 2010 -0.642278 seconds

    # service boot.clock start
    Set System Time to the current Hardware Clock Fri Feb 26 19:36:05 2010 -0.235004 seconds

    # date
    Sat Feb 27 01:37:41 GMT 2010

    # hwclock --hctosys
    # date
    Fri Feb 26 19:38:55 GMT 2010

    Think I'm going to write my own boot script and scrap boot.clock

    Thanks for the response ! It put me off in the right direction !
    Cheers !
    Jim

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Time/TimeZone set

    Quote Originally Posted by jamatwitsend View Post
    Well one thinks for sure ... boot.clock isn't working correctly ...
    It looks like you are running the hardware clock in local time, rather than UTC. If so, you should add the option -u to hwclock to display or set the right time.

    Also if you are not dual booting the machine with the Redmond OS, you should set hardware clock to UTC.

    You should understand the interactions between localtime, UTC and hardware clock before concluding that the boot script is wrong.

  6. #6

    Default Re: Time/TimeZone set

    O.K. - Fair enough ...

    # date
    Sat Feb 27 06:27:53 GMT 2010

    # hwclock -u
    Sat Feb 27 00:29:28 2010 -0.126645 seconds

    # service boot.clock start
    Set System Time to the current Hardware Clock

    # date
    Sat Feb 27 06:40:48 GMT 2010

    # hwclock -u
    Sat Feb 27 00:30:52 2010 -0.599809 seconds

    Pertinent parts of /etc/sysconfig/clock

    HWCLOCK="-u"
    SYSTOHC="yes"
    TIMEZONE="Europe/London"
    DEFAULT_TIMEZONE="US/Central"

    BTW - the comments in /etc/sysconfig/clock mention a /usr/lib/zoneinfo
    I see no such file or directory

    I will make no more assumptions about things being broken...I will leave that to those who do understand the interactions between localtime, UTC and hardware clock -- I'll only report what I see ...

    Cheers
    Jim

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Time/TimeZone set

    That comment is out of date, and this could be considered a trivial bug. The directory is /usr/share/zoneinfo.

    But you still haven't answered the real question before you went on this diversion, do you get the message

    Set Hardware Clock to the current System Time

    at shutdown, presumably after you have changed the timezone while the machine was up. That's the part that writes the time back to the hwclock.

    And anyway, if you are running the hwclock in UTC as the -u implies, then the hwclock should be at the correct time no matter what the timezone, and this writeback won't matter.

    But from what you report, it looks like the hwclock is already at the wrong time, because it should report localtime. You should fix it with

    hwclock --systohc -u

    after checking that the system time is correct.

  8. #8
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,645

    Default Re: Time/TimeZone set

    But Windows sets it to local time. But because you are in London and presumably have set your time zone to same you are now at UTC +0. And this is now your local time. You need to see what Yast thinks is happening. Yast-System-Date & Time, Make sure the UTC box is NOT checked. Be Sure the time zone reflects your current zone and be sure the time is then set to the correct local time/date. Save it

    Then in th GUI clock be sure that the zone is correct and matches the zone set in Yast

    That should do it. It is infinitely easier without Windows in the mix. You simply set the HW to UTC and move the time zones as needed.

  9. #9
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Time/TimeZone set

    Well, that's the other question he didn't answer, because we don't really know if he dual boots. However he uses UTC in Linux as the -u in /etc/sysconfig/clock shows. If he is using Windows, then that wouldn't work, Windows and Linux would be constantly resetting the hwclock their way and cause that kind of symptom.

  10. #10
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,645

    Default Re: Time/TimeZone set

    His "by the way remark" at the bottom says he is running XP on the same hardware so I assume he is dual booting.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •