Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: System time is always wrong after reboot

  1. #1

    Default System time is always wrong after reboot

    Every time I reboot my computer the system time always comes up exactly 10 hours behind where it should be. So if I reboot it at 16:00 it comes up as 06:00.

    This has only been happening since I got back from a trip to Australia, where I naturally changed the computer's timezone to match the local one. I'm now back in Central European Time which is 10 hours behind Australia's. This is on opensuse 11.3.

    I've used the YAST date and time tool to set the timezone correctly, and /etc/localtime is set correctly:
    Code:
    :~> sha1sum /etc/localtime
    b065fae6bda0f0642ca6a52b665768e34a99d213  /etc/localtime
    :~> sha1sum /usr/share/zoneinfo/Europe/Berlin 
    b065fae6bda0f0642ca6a52b665768e34a99d213  /usr/share/zoneinfo/Europe/Berlin
    The hardware clock is set correctly (I've had to manually restart ntp here to get date to show the correct time):
    Code:
    sudo hwclock --show; date
    Do 06 Jan 2011 16:13:20 CET  -0.375604 Sekunden
    Do 6. Jan 16:13:20 CET 2011
    I don't understand what the problem is.

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    15,742

    Default Re: System time is always wrong after reboot

    Do you have a multiboot system with an MS Windows as partner? And what did you choose in YaST fore the setting: Set hardware clock to GMT/Local time?
    Henk van Velden

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    3,220

    Default Re: System time is always wrong after reboot

    You might find a thread I started a few months ago interesting

    Which NTP client is preferred?

    It can get very confusing the more you think about the numerous possible combinations of configurations.

    In addition to what was posted there, you might also consider the "chicken or egg" quandry... What you're seeing now could also be influenced by what you did to set time when in Australia, not just what you are doing now.

    Proabably the bottom line recommendation:
    Using the YAST tool, configure time to be set by connecting to a Timeserver, not the local system settings. Then, keep an eye out for any higher level modifications. Of course, you'll need a working network connection to connect to a Timeserver.

    IMO,
    Tony

  4. #4
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,038

    Default Re: System time is always wrong after reboot

    If you have Windows on the computer, you need to leave Windows to handle the hardware clock; if you only have Linux, set the hardware clock to UTC and then go to YaST>System>Date and time. Set the hardware clock to UTC and set your timezone.

  5. #5

    Default Re: System time is always wrong after reboot

    Quote Originally Posted by hcvv View Post
    Do you have a multiboot system with an MS Windows as partner?
    Yes, I have Windows 7 on this laptop also. In the first reboot after I got back to Germany Windows 7 had the same problem - clock 10 hours behind, but after I set the clock properly (in Windows) Windows doesn't have this problem anymore.

    I don't think Windows is the cause of the problem in Linux either, since the problem occurs when I reboot from Linux back into Linux, with no loading of Windows inbetween.

    And what did you choose in YaST fore the setting: Set hardware clock to GMT/Local time?
    Where is this in the YAST GUI - I can't see it in the 'Date and Time' module? I do however have hardware clock set to local time in /etc/sysconfig/clock. I've also manually applied this setting (hwclock --localtime) a couple of times to see if this makes a difference, but so far no luck.

    My /etc/sysconfig/clock:
    Code:
    ## Path:                System/Environment/Clock
    ## Description:         Information about your timezone and time
    ## Type:                string(-u,--utc,--localtime)
    ## ServiceRestart:      boot.clock
    ## Command:             /sbin/refresh_initrd
    #
    # Set to "-u" if your system clock is set to UTC, and to "--localtime"
    # if your clock runs that way.
    #
    HWCLOCK="--localtime"
    ## Description: Write back system time to the hardware clock
    ## Type:                yesno
    ## Default:             yes
    #
    # Is set to "yes" write back the system time to the hardware
    # clock at reboot or shutdown. Usefull if hardware clock is
    # much more inaccurate than system clock.  Set to "no" if
    # system time does it wrong due e.g. missed timer interrupts.
    # If set to "no" the hardware clock adjust feature is also
    # skipped because it is rather useless without writing back
    # the system time to the hardware clock.
    #
    SYSTOHC="yes"
    
    ## Type:                string(Europe/Berlin,Europe/London,Europe/Paris)
    ## ServiceRestart:      boot.clock
    #
    # Timezone (e.g. CET or Asia/Tokyo). The value should correspond
    # to the contents of the /etc/localtime file and is for internal
    # YaST use; changing this setting will not make SuSEconfig update
    # the /etc/localtime file, YaST does that or you will need to do
    # this manually by calling zic -l.
    #
    TIMEZONE="Europe/Berlin"
    DEFAULT_TIMEZONE="US/Eastern"
    I don't understand why the problem occurs, as when I check the time in the BIOS setup screens as the system reboots the clock there is always correct. It's just Linux that's for some reason setting itself back 10 hours from this correct time.

  6. #6
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    4,985
    Blog Entries
    3

    Default Re: System time is always wrong after reboot

    Quote Originally Posted by tk83 View Post
    Yes, I have Windows 7 on this laptop also.
    In Windows, set the time zone to GMT (or UTC).

    Then follow the suggestions here: Set hardware clock to UTC on Windows (or how to make the clock work on a Mac Book Pro) - David Findley's Blog

    Then change Windows to use the timezone that you want. The effect is that the hardware clock will now remain at UTC (or GMT), no matter what timezone you use. This seems to work fine with Vista and Windows 7, but is a bit iffy with XP.

    Back in your linux system, use Yast to set the hardware clock to GMT.

    You might have to resynchronize with a time server. But, after that, you should not have future timezone problems.

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    15,742

    Default Re: System time is always wrong after reboot

    YaST > System > Date and Time. It is the checkbox lower left that says something like: set hardware clock to UTC (I called it GMT, buit that is the same for our purpose).

    I warn you that the thread tsu2 points to is interesting but confusing. In some places the difference between the setting of the Linux system time (at boot from the hardware clock and as soon as the network is up correcting it using NTP) to UTC (which is the time used by all Unix//Linux systems) and the setting of a time zone for a user (to make him/her see in his/her session a time translated to his/her wanted timezone) is often blurred there.
    Henk van Velden

  8. #8

    Default Re: System time is always wrong after reboot

    Quote Originally Posted by john_hudson View Post
    If you have Windows on the computer, you need to leave Windows to handle the hardware clock; if you only have Linux, set the hardware clock to UTC and then go to YaST>System>Date and time. Set the hardware clock to UTC and set your timezone.
    Yes. This has been - and probably still is - the easiest and most reasonnable solution for many years. If there is a way (as mentionned by nrickert in his post) to force Windows to use UTC, that would probably be better. On the other hand, notice that Ubuntu now defaults to localtime and do not give you another choice during setup! openSUSE still behaves like Unix regarding time ... but for how much longer?

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    21,963

    Default Re: System time is always wrong after reboot

    On 2011-01-06 20:06, tk83 wrote:
    >


    starting note: you should, or might, have changed the time, during the trip
    and later, only for the user. This is done in the desktop, or in console
    (not as root).

    > hcvv;2274496 Wrote:
    >> Do you have a multiboot system with an MS Windows as partner?

    >
    > Yes, I have Windows 7 on this laptop also. In the first reboot after I
    > got back to Germany Windows 7 had the same problem - clock 10 hours
    > behind, but after I set the clock properly (in Windows) Windows doesn't
    > have this problem anymore.


    Ok, good.


    > I don't think Windows is the cause of the problem in Linux either,
    > since the problem occurs when I reboot from Linux back into Linux, with
    > no loading of Windows inbetween.


    Yes, and no. It has some influence. I'll explain later.


    >> And what did you choose in YaST fore the setting: Set hardware clock to
    >> GMT/Local time?

    >
    > Where is this in the YAST GUI - I can't see it in the 'Date and Time'
    > module?


    A click box.

    > I do however have hardware clock set to local time in
    > /etc/sysconfig/clock.


    That's the same thing. :-)

    > I've also manually applied this setting (hwclock
    > --localtime) a couple of times to see if this makes a difference, but so
    > far no luck.


    Good. You are near the mark, but you need something else.

    >
    > My /etc/sysconfig/clock:
    >
    > Code:
    > --------------------
    > --------------------


    Good.



    > I don't understand why the problem occurs, as when I check the time in
    > the BIOS setup screens as the system reboots the clock there is always
    > correct. It's just Linux that's for some reason setting itself back 10
    > hours from this correct time.


    I think I do >:-)

    Ok, get the clock to display correctly your preferred way. Check that root
    has the correct time setting by using, in a terminal, the command "date".
    Check that the cmos clock is correct by using hwclock.

    And then, the untold trick: delete "/etc/adjtime"! :-D

    This file has saved that you once shifted the clock 10 hours, and is
    replaying the change on each boot. This is what it is for, it is thinking
    that your clock is too fast or slow, and adjusting automatically for it.

    So, delete that file, then redo the hwclock --localtime --systohc command
    to set the cmos clock and recreate the adjtime correctly.

    HTH.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  10. #10
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    21,963

    Default Re: System time is always wrong after reboot

    On 2011-01-06 21:36, please try again wrote:

    > On the other hand, notice that Ubuntu now defaults to
    > localtime and do not give you another choice during setup! openSUSE
    > still behaves like Unix regarding time ... but for how much longer?


    For ever :-)

    I think that the Ubuntu way only affects the cmos clock and how the system
    clock is initialized - ie, boot scripts. Once the system is running, the
    method is unchanged, it depends on the kernel, which keeps UTC time⁽¹⁾. And
    Ubuntu can't change that much the kernel ;-)

    (1) Well, not really UTC, but it close enough

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

Page 1 of 3 123 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
  •