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
tcpdump
Viewed 10448 times since Fri, Jul 27, 2018
How setting the TZ environment variable avoids thousands of system calls
Viewed 11284 times since Mon, May 21, 2018
10 nmap Commands Every Sysadmin Should Know
Viewed 11497 times since Wed, May 22, 2019
OCFS2 Cluster File System Setup Guide in Linux
Viewed 8949 times since Sat, Jun 2, 2018
ZPOOL: Create a new zpool for zfs filesystems
Viewed 3352 times since Sun, Jun 3, 2018
Enabling automatic updates in Centos 7 and RHEL 7
Viewed 3548 times since Wed, Oct 17, 2018
Open SSL HowTo: Decode SSL Certificate
Viewed 7015 times since Mon, Feb 18, 2019
BIND for the Small LAN
Viewed 4397 times since Sun, May 20, 2018
debian Debian/Ubuntu Linux: Find If Installed APT Package Includes a Fix/Patch Via CVE Number
Viewed 11334 times since Sun, Sep 23, 2018
Stunnel Setup
Viewed 19504 times since Fri, Sep 28, 2018