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
linux unix aix banner /etc/issue
Viewed 2644 times since Fri, Aug 3, 2018
An easier way to manage disk decryption at boot with Red Hat Enterprise Linux 7.5 using NBDE
Viewed 8984 times since Mon, Aug 6, 2018
Procedura powiekszania OCFS2 online
Viewed 6202 times since Fri, Jun 8, 2018
SSH ProxyCommand example: Going through one host to reach another server
Viewed 15080 times since Tue, Aug 6, 2019
Linux PAM configuration that allows or deny login via the sshd server
Viewed 2679 times since Wed, Oct 3, 2018
List DNS records, nameservers of a domain from command line
Viewed 2693 times since Sun, Sep 30, 2018
RHCS6: Install a two-node basic cluster
Viewed 4299 times since Sun, Jun 3, 2018
Watchdog script to keep an application running
Viewed 20224 times since Tue, Jul 31, 2018
How to manage Linux password expiry with the chage command
Viewed 12092 times since Tue, Sep 11, 2018
Super Grub2 Disk
Viewed 4234 times since Wed, May 22, 2019