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
Easily Find Bugs In Shell Scripts With ShellCheck
Viewed 3449 times since Thu, Apr 18, 2019
Top 25 Best Linux Performance Monitoring and Debugging Tools
Viewed 7222 times since Sun, Sep 30, 2018
Understanding logrotate utility part 1
Viewed 1887 times since Fri, Nov 30, 2018
RHEL: Crash kernel dumps configuration and analysis on RHEL 5
Viewed 7425 times since Sat, Jun 2, 2018
Stunnel Setup
Viewed 17983 times since Fri, Sep 28, 2018
Watchdog script to keep an application running
Viewed 18876 times since Tue, Jul 31, 2018
O’Reilly’s CD bookshelf
Viewed 13151 times since Wed, Jun 27, 2018
Build a simple RPM that packages a single file
Viewed 8734 times since Sat, Jun 2, 2018
6 easy steps to setup offline two factor authentication in Linux
Viewed 13506 times since Mon, Apr 6, 2020
Inxi – A Powerful Feature-Rich Commandline System Information Tool for Linux
Viewed 19039 times since Sat, Jun 2, 2018