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.

      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.

      Set the Hardware Clock to the current System Time.
0 (0)
Article Rating (No Votes)
Rate this article
There are no attachments for this article.
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
debian Debian/Ubuntu Linux: Find If Installed APT Package Includes a Fix/Patch Via CVE Number
Viewed 846 times since Sun, Sep 23, 2018
RHEL: iSCSI target/initiator configuration on RHEL6
Viewed 1550 times since Sat, Jun 2, 2018
linux ssh Remotely Initiated Reverse SSH Tunnel
Viewed 579 times since Wed, Apr 22, 2020
LVM: Remove a Filesystem / Logical Volume
Viewed 979 times since Sat, Jun 2, 2018
rabbitmq Troubleshooting TLS-enabled Connections
Viewed 227 times since Sun, Dec 6, 2020
How to deal with dmesg timestamps
Viewed 917 times since Wed, Oct 3, 2018
6 easy steps to setup offline two factor authentication in Linux
Viewed 678 times since Mon, Apr 6, 2020
Szybkie sprawdzenie zewnętrznego adresu IP i hosta
Viewed 1247 times since Thu, May 24, 2018
linux aix Killing a process and all of its descendants
Viewed 817 times since Tue, May 5, 2020
Extending Linux LVM partitions script
Viewed 732 times since Wed, Feb 6, 2019