RHEL: Getting/Setting hardware clock’s time

RHEL: Getting/Setting hardware clock's time

# Tested on RHEL 6 & 7

# Just an extract from 'hwclock' man page

   hwclock -r or hwclock --show
   hwclock -w or hwclock --systohc
   hwclock -s or hwclock --hctosys
   hwclock --set --date=newdate


   --show Read  the Hardware Clock and print the time on Standard Output.  The time shown is always in local time, even if you keep your
      Hardware Clock in Coordinated Universal Time.  See the --utc option.

   --set  Set the Hardware Clock to the time given by the --date option.

   --hctosys
      Set the System Time from the Hardware Clock.

      Also set the kernel's timezone value to the local timezone as indicated by the TZ environment variable and/or /usr/share/zone-
      info, as tzset(3) would interpret them.  The obsolete tz_dsttime field of the kernel's timezone value is set to DST_NONE. (For
      details on what this field used to mean, see settimeofday(2).)

      This is a good option to use in one of the system startup scripts.

   --systohc
      Set the Hardware Clock to the current System Time.
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
How to create a Systemd service in Linux
Viewed 3190 times since Mon, Dec 7, 2020
How to clear swap memory in Linux
Viewed 2231 times since Mon, Nov 23, 2020
Understanding logrotate utility part 1
Viewed 1926 times since Fri, Nov 30, 2018
How To Use Systemctl to Manage Systemd Services and Units
Viewed 7722 times since Mon, Dec 7, 2020
ZFS: Snapshots and clones on zfs filesystems
Viewed 3254 times since Sun, Jun 3, 2018
How to automate SSH login with password? ssh autologin
Viewed 2923 times since Fri, Jun 8, 2018
“Too many authentication failures” with SSH
Viewed 6245 times since Mon, May 21, 2018
HowTo: The Ultimate Logrotate Command Tutorial with 10 Examples
Viewed 5605 times since Fri, Nov 30, 2018
OEL 7 – How to disable IPv6 on Oracle Linux 7 – Follow Up
Viewed 9680 times since Wed, Jul 25, 2018
Build a simple RPM that packages a single file
Viewed 8786 times since Sat, Jun 2, 2018