重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3192|回复: 0
打印 上一主题 下一主题

linux时钟基本概念、CST与UTC、以及NTP简单设置

[复制链接]
跳转到指定楼层
楼主
发表于 2013-12-22 22:19:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

1,安装linux的时候在设置时间的时候有一个选项:
system clock uses UTC,那么这个UTC是什么意思呢?


世界协调时间(Universal Time Coordinated,UTC)
GPS 系统中有两种时间区分,一为UTC,另一为LT(地方时)两者的区别为时区不同,UTC就是0时区的时间,地方时为本地时间,如北京为早上八点(东八区),UTC时间就为零点,时间比北京时晚八小时,以此计算即可


2,在linux中,用date查看时间的时候显示:
2008年 12月 17日 星期三 09:04:14 CST
这个CST是什么意思呢?

CST China Standard Time UTC+8:00 中国沿海时间(北京时间)

############################################

以下内容是关于帮助你在linux下设置日期和时间的一些步骤,也包含了一点ntpd时间同步的内容。特别提醒的是在发行版本的限制是red hat系列,包括fedora,centos,redflag,unbreakable linux等。

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.

在linux下有两个时钟需要配置,硬件时钟和系统时钟。硬件时钟在系统启动时决定系统时钟,当系统处于运行状态下时,修改其中任何一个并不能对另一个默认生效。

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. 现在大部分的发行版本在图形界面下都提供了时钟设置工具,例如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
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-12 08:21 , Processed in 0.119248 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表