I have just installed Ubuntu 16.04.1 replacing Windows 8.1. But the system time +5:30 ahead of actual time. I am from India and the UTC offset is +5:30. By running hwclock i found that my system interprets the hardware clock as UTC, while it actually is the local time. I tried to edit the /etc/default/rcS file (as per Hardware clock is using UTC time). But rcS file doesn't contain the UTC entry. The file contents are shown below. What can be done?

Result of 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 file:

# /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

# spawn sulogin during boot, continue normal boot if not used in 30 seconds

# do not allow users to log in until the boot has completed

# be more verbose during the boot process

# automatically repair filesystems with inconsistencies during boot
  • Try this and see if it works - Ubuntu. After that do - sudo hwclock --systohc --utc – Raphael Sep 19 '16 at 9:08

If file /etc/adjtime is not present, systemd assumes the hardware clock is set to UTC.

The hardware clock can be queried and set with the timedatectl command. To change the hardware clock time standard to localtime, use:

sudo timedatectl set-local-rtc 1

If you want to revert to the hardware clock being in UTC, do:

sudo timedatectl set-local-rtc 0

These will generate /etc/adjtime automatically and update the RTC accordingly; no further configuration is required.

  • I executed the command, but nothing changed , even after a reboot – Subin P Sep 19 '16 at 8:19
  • What is output ot timedatectl command now? Are there string "RTC in local TZ: yes"? – Igor Shipenkov Sep 19 '16 at 8:41
  • I was able to fix it by combining @Melebius 's answer and 'sudo timedatectl set-local-rtc 1'. Now hwclock --debug gives correct values for UTC and Local Time. Thanks ! – Subin P Sep 19 '16 at 9:55

If you are not going to use Windows again, I recommend just setting the time (date -s command) and keeping UTC in the hardware clock.

  • Fixed, when i did what you said along with 'sudo timedatectl set-local-rtc 1'. Thanks. – Subin P Sep 19 '16 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.