Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-21-2015, 05:09 AM   #1
Registered: Jun 2008
Posts: 126

Rep: Reputation: 0
How to set Hardware clock

Hello Experts,

I am very much confused between System clock and Hardware clock.

On one of my Linux System, BIOS Shows the time as lets say 09:00:00 Hrs. And when I boot into the Linux OS , it Shows the time as 11:00:00. Which is the correct current time set by NTP daemon.

If I adjust the BIOS time to current time which is 2 Hours ahead of the BIOS time, then in the OS the time is Extended by 2 Hours as well.

I see the Point here is that System clock is always (+2) But is not correct.
I wish to have the same time in BIOS as what my OS is showing.

I can check the hwclock time using following command,

cat /proc/driver/rtc

rtc_time : 09:15:47
rtc_date : 2015-10-21
rtc_epoch : 1900
alarm : 15:37:00
DST_enable : no
BCD : yes
24hr : yes
square_wave : no
alarm_IRQ : yes
update_IRQ : no
periodic_IRQ : no
periodic_freq : 1024
batt_status : okay

So i think RTC is what Hwclock in BIOS is.
I also found that the command "hwclock --systohc --localtime" will set the RTC time to current time. But this has no effect on the actual Hardware clock in BIOS.

So how do we cut out the difference between hwclock and System clock??

Any pointers would be helpful.


- Admin
Old 10-21-2015, 05:19 AM   #2
Senior Member
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,401
Blog Entries: 3

Rep: Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513Reputation: 513
How to set Hardware clock

Could try, from memory, 'hwclock --hctosys' or hwclock --help to check the right syntax.

Last edited by Tonus; 10-21-2015 at 05:27 AM.
Old 10-21-2015, 06:27 AM   #3
Registered: Aug 2002
Posts: 25,669

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
The hardware or BIOS clock can be configured in the system for either UTC or local time.

If the clock is configured for UTC time by the system which is the preferred method, the displayed time difference should be your time zone offset and in your case I assume +2.0. The /etc/adjtime file is used to configure the system for the hardware clock to be either local or UTC time.

Once the hardware clock is configured for local time you then need to set it to the current time.
Old 10-21-2015, 08:39 PM   #4
LQ Guru
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,307
Blog Entries: 28

Rep: Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136Reputation: 6136
I usually set the system clock using the date command. This link is pretty much a rewrite of the man page plus examples:

Then I set the hardware clock from the system clock:

hwclock -w
There are other ways to do it, but that's the one that was easiest for me to remember.

See the hwclock and date man pages for more.
Old 10-21-2015, 09:11 PM   #5
Doug G
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
If you have a systemd distribution you can use the timedatectl utility to set os time, hwclock time, date, timezone, and more.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed to set system clock to hardware clock jrtayloriv Linux - Newbie 2 09-25-2008 07:06 AM
set hardware clock HE12 Programming 1 08-17-2007 10:06 AM
Where does RH8 daily set system time to hardware clock time smartnorman Red Hat 1 05-24-2006 02:42 PM
i can't set my hardware clock jogurt666 Linux - General 3 08-05-2004 10:22 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration