RHEL: Getting/Setting hardware clock’s time
Article Number: 118 | Rating: Unrated | Last Updated: Sat, Jun 2, 2018 8:30 AM
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. |