个人工具
登录
查看“UbuntuHelp:UbuntuTime”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:UbuntuTime”的源代码
来自Ubuntu中文
←
UbuntuHelp:UbuntuTime
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/UbuntuTime}} {{Languages|UbuntuHelp:UbuntuTime}} == Ubuntu Time Management == This page gives useful information about the way that Ubuntu manages time by changing the timezone, setting up synchronization using Network Time Protocol(NTP), and adjusting servers. === Changing the Time Zone === This section shows you how to accomplish this task using either the Graphical User Interface(GUI) or by using the command line(terminal). ==== Using the GUI ==== Perhaps the most user friendly way to change the time zone of your Ubuntu system is to use the Graphical User Interface(GUI). 0. Right-click on your clock, and choose '''Adjust Time & Date''', it will open up the following window: https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui0.png 0. Click on the currently selected time zone to bring up the selection map. https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui5.png 0. Click in the general area of your location on the time zone map, the map will zoom in. https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui7.png 0. Select the closest city then choose '''Close''' https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui8.png ==== Using the Command Line(terminal) ==== Using the command line, you can use <code><nowiki>tzconfig</nowiki></code>. The man page of this tool has a good explanation on how to set time on a Linux system, how it differs from other systems, and what you have to consider when using computers in a network. 0. Open a terminal window by going to Applications>Accessories>Terminal 0. `tzconfig` 0. Follow the directions in the terminal. === Time Synchronization using NTP === This page describes methods for automatically keeping your computer's time accurate. This is extremely useful for servers, and is also recommended for desktop machines. Network Time Protocol(NTP) is a TCP/IP protocol for synchronizing time over a network connection. Basically a client requests the current time from a server, and then uses the servers response to set its own clock. Beyond this simple description, there is a lot of complexity. There are multiple tiers of NTP servers, with the tier one NTP servers connected to atomic clocks (often via GPS), and tier two and three servers spreading the load of actually handling requests across the internet. The client software is a lot more complex than you might think as it has to factor communication delays, and adjust the time in a way that does not affect the other processes that run on the system. Luckily all that complexity is hidden from the user. ==== Using the GUI ==== This is how to enable NTP time synchronization using the GUI(Graphical User Interface). 0. Right click on the clock in the top right hand corner of your desktop and select Adjust Date & Time https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui0.png 0. You may have to enter your password to continue. https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui1.png 0. Select the configuration option '''Keep synchronized with Internet servers''' https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui2.png 0. You may get a dialog box informing you that NTP support has to be installed. https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui3.png 0. After selecting '''Install NTP Support''' it will download the needed files. https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui4.png 0. You are now finished and you can click '''Close''' or you can customize the NTP servers(default is ntp.ubuntu.com) that your computer uses to synchronize with by choosing '''Select Servers'''. https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui5.png ==== Command Line ntpdate ==== Ubuntu comes with ntpdate as standard, and will run it once at boot time to set up your time according to Ubuntu's NTP server. However, a system's clock is likely to drift considerably between reboots if the time between reboots is long. In that case it makes sense to correct the time occasionally. The easiest way to do this is to get cron to run it every day. With your favorite editor, create a file `/etc/cron.daily/ntpdate` containing: <pre><nowiki> sudo ntpdate ntp.ubuntu.com </nowiki></pre> Make sure that you make this new file executable: <pre><nowiki> sudo chmod 755 /etc/cron.daily/ntpdate </nowiki></pre> ==== Command Line ntpd ==== ntpdate is a bit of a blunt instrument as it can only adjust the time once a day in one big correction. The ntp daemon ntpd is far more subtle as it calculates the drift of your system clock and continuously adjusts it in small increments. Using ntpd there are no large corrections that could lead to inconsistent logs for instance. The cost is a little processing power and memory, but for a modern system this is negligible. To set up ntpd pre Ubuntu 7.04: <pre><nowiki> sudo apt-get install ntp-simple </nowiki></pre> To setup ntpd in versions of Ubuntu 7.04 and higher <pre><nowiki> sudo apt-get install ntp </nowiki></pre> === Changing NTP Time Servers === In both cases above, your system will use Ubuntu's NTP server at `ntp.ubuntu.com` by default. This is OK, but you might want to use several servers to increase accuracy and resilience, and you may want to use time servers that are geographically closer to you. ==== Using the GUI ==== 0. Right click on the clock in the top right hand corner of your desktop and select Adjust Date & Time https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui0.png 0. You may have to enter your password to continue. https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui1.png 0. Select '''Configure Servers''' https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui5.png 0. Enable the box next to your choice of server(s) or add your own. https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=ntpgui6.png ==== ntpdate ==== Change the contents of `/etc/cron.daily/ntpdate` to: <pre><nowiki> ntpdate ntp.ubuntu.com pool.ntp.org </nowiki></pre> ==== ntpd ==== Change the contents of `/etc/ntp.conf` to include additional server lines: <pre><nowiki> ntp.ubuntu.com server pool.ntp.org </nowiki></pre> You may notice `pool.ntp.org` in the examples above. This is a really good idea which uses round-robin DNS to return an NTP server from a pool, spreading the load between several different servers. Even better, they have pools for different regions - I am in New Zealand, so I use `nz.pool.ntp.org` instead of `pool.ntp.org`. Look at http://www.pool.ntp.org/ for more details. You can also Google for NTP servers in your region, and add these to your configuration. To test that a server works, just type `sudo ntpdate ntp.server.name` and see what happens. === Multiple Boot Systems Time Conflicts === Operating systems store and retrieve the time in the hardware clock located on your motherboard so that it can keep track of the time even when the system does not have power. Most current operating systems(Linux/Unix/Mac) store the time on the hardware clock as UTC/GMT, though some systems(MSWindows) store the time on the hardware clock as the 'local' time. This causes problems in a dual boot system as both systems view the hardware clock differently. It is usually better to have the hardware clock as UTC because then you don't need to change the hardware clock when Daylight Savings Time(DST) begins or ends as UTC does not have DST. ==== Make Windows use UTC ==== To make MS Windows calculate the time from the hardware clock as UTC. Create a file named https://help.ubuntu.com/community/UbuntuTime?action=AttachFile&do=get&target=WindowsTimeFixUTC.reg with the following contents and then double click on it to merge the contents with the registry: <pre><nowiki> Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] "RealTimeIsUniversal"=dword:00000001 </nowiki></pre> ==== Make Linux use 'Local' time ==== To make your Ubuntu system read the hardware clock as 'local' 0. edit /etc/default/rcS 0. add or change the following section <pre><nowiki> # Set UTC=yes if your system clock is set to UTC (GMT) UTC=no </nowiki></pre> ---- [[category:CategoryDocumentation]] [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:UbuntuTime
。