Linux Clock : CST,UTC and NTP setup

  sonic0002        2013-03-21 12:19:30       22,006        0    

1. There is an option when you set up clock on installing Linux: system clock users UTC, so what does UTC mean?

It's Universal Time Coordinated(UTC), there are two different times in GPS system: one is UTC , the other one is LT(Local Time). The difference between these two is just the timezone difference, UTC is the time in timezone 0. If the local time in Beijing is 8 o'clock in the morning, then UTC time is 0 o'clock, which is a 8 hour difference.

2. In Linux, when we use date to check the time, we may get 17 December,2008 Wednesday 09:04:14 CST. What does CST ,mean here?

CST is China Standard Time UTC+8:00, which is Beijing Time.

Below steps are what you can follow to set up your date and time in Linux, they include some content related to ntpd time synchronization.

There are two clocks to configure in Linux, the hardware clock and the system clock. The hardware clock determines the system clock on system boot. While the system is running, changes to one of these doesn't affect the other.

Note: it's best to set the hardware clock and have the system clock be set upon a reboot. Changing the system clock by using the date program on a running system could cause date discontinuities and consequently problems. If you will be using ntpd, you probably don't need to set either of these clocks (unless the current time is more than 1000s off the real time). Just setup ntpd and let ntpd adjust the time (it will do it in small steps to keep system timestamps reliable).

  1. Now many releases with GUI have clock set up tools built in, such as kde gnome.
  2. You can use timeconfig to configure the timezone and UTC settings. Timeconfig will update /etc/sysconfig/clock and /etc/localtime.

  3. Set the time zone manually if not already set.

    Linux uses the file /etc/localtime to determine the time zone. This file should be either a copy of the appropriate timezone file from the directory /usr/share/zoneinfo or a symbolic link. If your time zone is incorrect, create a symbolic link to the appropriate timezone file.
    # ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  4. Set whether hwclock uses local time or UTC

    Edit the file /etc/sysconfig/clock and change "UTC=" to true or false. If you have a dual-boot system with Windows, using UTC may cause problems for Windows.

  5. Set the system clock
    # date MMDDhhmmCCYY.ss
    where MM is month, DD is day, hh is hour, mm is minutes, CCYY is year and ss is seconds. Time should be in 24-hour notation.

    To only set the time:
    # date -s hh:mm:ss
  6. Set the hardware clock

    To set the hardware clock to the current system clock:
    # setclock
    this method looks at /etc/sysconfig/clock to determine whether the hardware clock is set to UTC

    Another method:
    # hwclock --systohc
    # hwclock --systohc --utc
    use the second option if you use UTC.

    Set hwclock manually:
    # hwclock --set --date="9/22/96 16:45:05"
    Everytime you use the hwclock --set command, it will create or edit the file /etc/adjtime to determine the systematic drift. Once you have some history, you can use the --adjust option to adjust the hardware clock appropriately. Run as a cron job if you want the clock to adjust automatically on a regular schedule. Don't use the --adjust function when using ntpd since ntpd will turn the "11 minute mode" on, which is best left alone. See the hwclock manpage for more info.

  7. Setup ntpd for automatic synchronization with a remote server.

    Run Red Hat's setup utility to make ntpd start on boot up and edit /etc/ntp.conf

    Set server and fudge options:
    server time.nist.gov
    fudge time.nist.gov stratum 10
    Enable multicastclient:
    multicastclient     # listen on default 224.0.1.1
    Edit /etc/sysconfig/ntpd if necessary. The default should be fine.

    Start the ntpd daemon:
    # service ntpd start

Source : http://space.itpub.net/23137730/viewspace-661609

LINUX  CLOCK  UTC 

       

  RELATED


  0 COMMENT


No comment for this article.



  RANDOM FUN

Honda to Hyundai

When we add <i> tag to Honda, we get a Hyundai.