Time

From ArchWiki
Revision as of 14:32, 15 December 2009 by Gen2ly (Talk | contribs) (Created page with 'This page will show how to read and set the hardware clock (a.k.a. the Real Time Clock (RTC) or CMOS clock) and the system clock. == About == The hardware clock keeps values of…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page will show how to read and set the hardware clock (a.k.a. the Real Time Clock (RTC) or CMOS clock) and the system clock.

About

The hardware clock keeps values of year, month, day, hour, minute, and seconds. The hardware clock time value may either be in the localtime standard or the Coordinated Universal Time (UTC) standard. Localtime is dependent on your local time zone while UTC (aka Greenwich (GMT) time) is global time and independent of time zone values. The hardware clock can only store time values and does not store information on whether localtime or UTC time is used, nor whether daylight savings time is used. Common operating systems like Windows and Mac OS will set the hardware clock dependent on your timezone (localtime), while UNIX-like operating systems can be told to use either value.

UNIX-like operating systems also have a system clock that runs independent of the hardware clock that is often set with a program like NTP. The Arch Linux script (Template:Filename) sets the software clock from the hardware clock on boot, and the script (Template:Filename) sets the hardware clock from the system clock on shutdown.

Time Standard

You can set the time standard through the command line. You can check what you have set your Arch Linux install to use by:

grep ^HARDWARECLOCK /etc/rc.conf

To immediately change the hardware clock time standard, you can set localtime by (if you use Windows or Mac OS you will want to use this):

hwclock --localtime

And to set it as UTC by:

hwclock --utc

The time standard will also need to be entered in your Arch Linux system configuration so that it will be set the next time you restart:

HARDWARECLOCK="localtime"

or

HARDWARECLOCK="UTC"

Your hardware clock and system clock time may been to be updated after this, read #Time Set.

Time Zone

Be sure that your time zone is set correctly in Template:Filename, this not only necessary for the localtime to be set correctly but also for other programs you may use. You can do this by:

grep ^TIMEZONE /etc/rc.conf

You can find the timezones listed in Template:Filename and then entering a nearby city is usually the preferred way to to this. For example:

TIMEZONE="America/Chicago"

The new timezone will be taken into effect when you set the hardware clock, see the next step.

Time Set

The hardware clock can either be set directly or from the system clock. To check the current hardware clock time and system clock time respectively:

hwclock --show
date

To set the hardware clock directly (in military time):

hwclock --set --date "MM/DD/YYYY hh:mm:ss"

To set the system clock:

date MMDDhhmmYYYY

The hardware clock can be set from the system clock and vice versa:

hwclock --systohc
hwclock --hctosys