Clock setting problem in Centos 5


Results 1 to 2 of 2

Thread: Clock setting problem in Centos 5

  1. #1
    Join Date
    Oct 2003
    Location
    Chandigarh,India
    Posts
    1

    Clock setting problem in Centos 5

    Dear Experts,

    Currently i have installed three OS in my system (1) Windows XP (2) Whitebox Linux 4 (3) Centos 5. I have checked my hardware clock in CMOS. That is configured properly. When I am booting in Centos 5 - here the clock is showing wrong time. Ok I correct this time manually. But when i am booting my Windows XP it is showing the wrong time, but it was working fine before correcting the time in centos 5. The same is happening in White Box Linux 4 also. Let me know that where is the problem.


    Vijay Thakur
    Chandigarh
    India

  2. #2
    Join Date
    Apr 2001
    Location
    SF Bay Area, CA
    Posts
    14,936
    The Linux system clock (not the CMOS clock, but the one that the kernel keeps) is always stored in the UTC timezone. (That's effectively GMT, but it's possible that there aren't any leap second adjustments, I'm not sure.) Whenever a program asks for the current time, the C library converts from the kernel's UTC time into the program's current timezone. (The timezone is set via the $TZ environment variable, or if that isn't set, the /etc/localtime file.) This way, when daylight-saving time goes into effect (or when a user changes their timezone), Linux doesn't have to change its internal clock. That's important if you have multiple users on a machine that want their time to show up in different timezones, which Linux does.

    Anyway, the reason I even mention any of this is because it means that you can set your hardware (CMOS) clock to store either UTC, or local time. Windows only understands having the CMOS clock in local time (because it's amazingly stupid: it has always assumed one user per machine, and it has also always assumed that that single user is always in one timezone), but Linux can handle either, assuming it knows the offset from the time stored in the CMOS clock to current UTC.

    If the time that CentOS shows is offset from your local timezone by the same amount that that timezone is offset from UTC, then I would suspect that you're storing local time in your CMOS clock, but CentOS is configured to store UTC time in the CMOS clock instead. It will also load the time from the CMOS clock assuming it's UTC; that's where the problem happens.

    (For instance, I'm in the UTC-5 timezone right now. If I were to write the local time to the CMOS clock, then load that time back into the system clock assuming it was UTC, then the system's time would be 5 hours behind, because the minus-5-hours offset got applied twice. If this is the problem, then that's the time offset that you would have too: double your timezone offset.)

    I'm not sure how to configure CentOS to keep local time in the CMOS clock, but it should be possible. (The program that reads and writes the CMOS clock can do either.) If that's the issue, then hopefully you can find a way to configure CentOS to do it properly -- or maybe someone else here that runs CentOS knows?

Posting Permissions

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