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
LVM: Managing snapshots
Viewed 8359 times since Sat, Jun 2, 2018
Use Fail2ban to Secure Your Server
Viewed 15886 times since Fri, Jul 5, 2019
RHCS6: Show/Add GFS2/GFS journals
Viewed 13315 times since Sun, Jun 3, 2018
Use inotify-tools on CentOS 7 or RHEL 7 to watch files and directories for events
Viewed 14825 times since Fri, Jul 27, 2018
Using stunnel and TinyProxy to obfuscate HTTP traffic
Viewed 7829 times since Fri, Sep 28, 2018
Monitoring bezpieczeństwa Linux: integracja auditd + OSSEC cz. I
Viewed 3011 times since Fri, Apr 5, 2019
Linux Linux Network Statistics Tools / Commands
Viewed 9827 times since Mon, Sep 21, 2020
How To Use the Linux Auditing System on CentOS 7
Viewed 4634 times since Fri, Apr 5, 2019
Modifying the inode count for an ext2/ext3/ext4 file system
Viewed 16682 times since Fri, Sep 18, 2020
CentOS / RHEL : Configure yum automatic updates with yum-cron service
Viewed 4045 times since Fri, Oct 26, 2018