Hwclock

From MineOS Wiki
Jump to navigation Jump to search

The system time and the hardware clock are two separate times.

The system time is the time that will be used in all time/date comparisons as well as timestamps. The hardware clock is the time the physical hardware believes it to be.

Having two separate times is not problematic, rather, in ways it is much more precise.

  1. For physical machines, it is likely the hardware clock (usually set in BIOS) will refer to the local time. This typically will account for things such as leap years, though not likely time zones (with regard to DST).
  2. For virtual machines--such as in VirtualBox--it is advised to use the setting 'Set Hardware Clock to UTC'.

Use UTC for hwclock

Why is it recommended to use UTC for the hardware clock, regardless of the deployment platform? UTC is a standardized time, which will never differ regardless of the year or season. It is a steady, Daylight-Saving-Time-free system. As a result, Linux has widely accepted UTC as the most reliable time zone.

However, when looking at timestamps, it is un-intuitive to deal with time that 'is in the future' -- or perform an action that is suddenly logged as much farther in the past. This is where system time comes in. By already setting the timezone using the appropriate timezone script provided in MineOS, (/root/runonce/timezone), the system clock can be automatically adjusted for your geographic region.

Setting the system time for individual time zones

  • -u indicates that the hardware clock is in UTC
  • -s indicates that the current system time should be calculated based on the time-zone difference (-/+) and DST

Therefore, all your files will appropriately reflect your own local time, and you will never need to manually adjust for DST--any changes in geographic location should simply be updated in the TIMEZONE value of /etc/rc.conf or better, using the MineOS Timezone script.