When you install Linux on a PC, you may find that the hardware clock enforced the time. Normally, you would use the ntpd (network time protocol daemon) to synchronise the system (software) time with a selection of external sources.
However, what if you are not connected, or for some reason just don't have access to time servers (for example the ntpd port 123 is blocked)?
Well, unless you need to maintain a precise time (in which case you still need to find access to a reliable source), you can just use the good old date command and inform the hardware clock of the change.
# date --utc 101517052007.00
will update the system (software) clock and set the current time and date to: Oct 15 18:05:00 BST 2007.
The only problem is that system clock doesn't run when your machine is powered off. What does continue to run is the hardware clock. It ticks forever. External power present or not. Because on start-up the hardware clock is used, you need to flush the system date into the hardware clock, and as long as the hardware clock is accurate enough, your newly adjusted time will be persistent over reboots.
Use the hwclock tool to achieve this:
# hwclock --systohc
Do remember, though: this is 'quick and dirty'. If you require consistent and accurate time keeping, you need to synchronise the system clock with an external source...
Twitter Updates
G-AVLN in front of her home
Mostly Unix and Linux topics. But flying might get a mention too.
Subscribe to:
Post Comments (Atom)
Blog Archive
- October (1)
- June (1)
- April (2)
- February (3)
- June (1)
- March (1)
- August (3)
- July (2)
- June (1)
- March (1)
- June (3)
- May (1)
- April (5)
- February (1)
- January (5)
- October (1)
- September (3)
- July (4)
- June (5)
- April (3)
- March (1)
- February (3)
- January (3)
- October (7)
- August (2)
- July (3)
- May (1)
- November (4)
- October (1)
- September (1)
- August (2)
- July (2)
- June (3)
- May (3)
- April (2)
- March (2)
- February (3)
- January (1)
- December (2)
- November (1)
- October (6)
- September (6)
- August (1)
- July (2)
- June (8)
- May (3)
- April (4)
- March (3)
1 comment:
Interesting to know.
Post a Comment