简体   繁体   English

Ubuntu Amazon EC2 夏令时日期

[英]Ubuntu Amazon EC2 Date with daylight savings

I am running an Amazon EC2 server with Ubunutu and I need the server to be able to get the current time for my system.我正在使用 Ubunutu 运行 Amazon EC2 服务器,我需要该服务器能够获取我的系统的当前时间。 However, since Daylight Savings the time has been an hour behind (obviously) and I can't work out exactly what the best way is to go about's changing this?但是,由于夏令时时间已经晚了一个小时(很明显),我无法确定 go 改变这个的最佳方法是什么?

Modern Unix systems run a timezone database and automatically adjust for daylight savings time.现代 Unix 系统运行时区数据库并自动调整夏令时。 You may find a file named something like /etc/timezone that contains the time zone used by default by programs running on the system.您可能会发现一个名为/etc/timezone的文件,其中包含系统上运行的程序默认使用的时区。 However, the system clock itself will be kept in UTC (aka Greenwich Mean Time in old fashioned terminology) and the presented time is derived from UTC by a library.然而,系统时钟本身将保存在 UTC(旧式术语中又称为格林威治标准时间),并且呈现的时间由库从 UTC 派生。

If the system clock is accurate, getting the time with the correct time zone is simply a matter of properly setting the right string in the timezone file, and the system will properly present the time with the correct DST adjustment.如果系统时钟准确,获得正确时区的时间只是在时区文件中正确设置正确字符串的简单问题,系统将通过正确的 DST 调整正确显示时间。

If the clock itself is not accurate, setting the time on a modern Unix system is generally done using ntpd -- read the documentation for that -- though virtual machines often already have the time accurately set by the host OS and I wouldn't fiddle with that to start with.如果时钟本身不准确,则通常使用 ntpd 在现代 Unix 系统上设置时间——阅读相关文档——尽管虚拟机通常已经由主机操作系统准确设置了时间,我不会摆弄从那开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM