硬件时钟解释为UTC

我刚刚安装了Ubuntu 16.04.1取代了Windows 8.1。 但系统时间比实际时间提前+5:30。 我来自印度,UTC偏移是+5:30。 通过运行hwclock,我发现我的系统将硬件时钟解释为UTC,而实际上是本地时间。 我尝试编辑/ etc / default / rcS文件(根据硬件时钟使用UTC时间 )。 但是rcS文件不包含UTC条目。 文件内容如下所示。 可以做些什么?

hwclock的结果–debug:

hwclock from util-linux 2.27.1 Using the /dev interface to the clock. Last drift adjustment done at 1474290330 seconds after 1969 Last calibration done at 1474290330 seconds after 1969 Hardware clock is on local time Assuming hardware clock is kept in local time. Waiting for clock tick... ...got clock tick Time read from Hardware Clock: 2016/09/19 18:55:12 Hw clock time : 2016/09/19 18:55:12 = 1474291512 seconds since 1969 Time since last adjustment is 1182 seconds Calculated Hardware Clock drift is 0.000000 seconds Monday 19 September 2016 06:55:11 PM IST .186866 seconds 

rcS文件:

 # # /etc/default/rcS # # Default settings for the scripts in /etc/rcS.d/ # # For information about these variables see the rcS(5) manual page. # # This file belongs to the "initscripts" package. # delete files in /tmp during boot older than x days. # '0' means always, -1 or 'infinite' disables the feature #TMPTIME=0 # spawn sulogin during boot, continue normal boot if not used in 30 seconds #SULOGIN=no # do not allow users to log in until the boot has completed #DELAYLOGIN=no # be more verbose during the boot process #VERBOSE=no # automatically repair filesystems with inconsistencies during boot #FSCKFIX=no 

如果文件/ etc / adjtime不存在,则systemd假定硬件时钟设置为UTC。

可以使用timedatectl命令查询和设置硬件时钟。 要将硬件时钟时间标准更改为本地时间,请使用:

 sudo timedatectl set-local-rtc 1 

如果要恢复为UTC的硬件时钟,请执行以下操作:

 sudo timedatectl set-local-rtc 0 

这些将自动生成/ etc / adjtime并相应地更新RTC; 无需进一步配置。

如果您不打算再次使用Windows,我建议您只设置时间( date -s命令)并将UTC保持在硬件时钟中。