Managing System Time - Paiet/Tech-Journal-for-Everything GitHub Wiki
- Time is used for many things
- Your calendar and clock
- Scheduling tasks (cron)
- Logging and auditing
- Security protocols like IPSec
- Accurate time
- Can be manually set
- Can be imported from the hardware clock
- Can be imported from an NTP server
- Start with the timezone
- Configuring a timezone without systemd
- Before systemd it was all over the place2
- Places to check:
- /etc/timezone
- /etc/localtime
- /usr/share/zoneinfo
tzselect
tzconfig
- $TZ
- In RedHat/CentOS use:
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
- In Ubuntu:
- Configuring a timezone with systemd
timedatectl
- timedatectl list-timezones
- timedatectl list-timezones | grep America
- sudo timedatectl set-timezone America/New_York
- Setting the time
timedatectl set-time "yyyy-MM-dd hh:mm:ss"
- Configuring the hardware clock
date
hwclock -r
date -s "1 JUN 2021 12:00:00"
hwclock --systohc (or -w)
hwclock --hctosys (or -s)