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
ZFS: Grow/Shrink an existing zfs filesystem
Viewed 5984 times since Sun, Jun 3, 2018
Secure NTP with NTS
Viewed 8093 times since Sun, Dec 6, 2020
logrotate - rotates, compresses, and mails system logs.
Viewed 1538 times since Fri, Nov 30, 2018
How to use yum command on CentOS/RHEL
Viewed 10655 times since Wed, Oct 17, 2018
RHCS6: ’fencing’ basics
Viewed 2040 times since Sun, Jun 3, 2018
Fix rpmdb: Thread died in Berkeley DB library
Viewed 20769 times since Fri, Feb 14, 2020
Setting up encrypted tunnel using stunnel
Viewed 2192 times since Fri, Sep 28, 2018
20 IPtables Examples For New SysAdmins
Viewed 1921 times since Fri, May 15, 2020
6 easy steps to setup offline two factor authentication in Linux
Viewed 11911 times since Mon, Apr 6, 2020
How to sort IP addresses in Linux
Viewed 3292 times since Sun, May 20, 2018