Resetting the Date and Time


The Fedora installer will query you during installation for default time zone settings, and whether or not your computer's hardware clock is set to Greenwich Mean Time (GMT)more properly known as UTC or Coordinated Universal Time.

Linux provides a system date and time; your computer hardware provides a hardware clock-based time. In many cases, it is possible for the two times to drift apart. Linux system time is based on the number of seconds elapsed since January 1, 1970. Your computer's hardware time depends on the type of clock chips installed on your PC's motherboard, and many motherboard chipsets are notoriously subject to drift.

Keeping accurate time is not only important on a single workstation, but also critically important in a network environment. Backups, scheduled downtimes, and other network-wide actions need to be accurately coordinated.

Fedora provides several date and time utilities you can use at the command line or during an X session, including these:

date Used to display, set, or adjust the system date and time from the command line

hwclock A root command to display, set, adjust, and synchronize hardware and system clocks

system-config-date Fedora's graphical date, time, and network time configuration tool

Using the date Command

Use the date command to display or set your Linux system time. This command requires you to use a specific sequence of numbers to represent the desired date and time. To see your Linux system's idea of the current date and time, use the date command like this:

# date Wed Jan 10 14:17:01 EDT 2005


To adjust your system's time (say, to January 27, 2006 at 8 a.m.), use a command line with the month, day, hour, minute, and year, like so:

# date 012606002003 Fri Jan 27 08:00:00 EDT 2003


Using the hwclock Command

Use the hwclock command to display or set your Linux system time, display or set your PC's hardware clock, or to synchronize the system and hardware times. To see your hardware date and time, use hwclock with its --show option like so:

# hwclock --show Fri 27 Jan 2006 02:17:53 PM GMT -0.193809 seconds


Use hwclock with its --set and --date options to manually set the hardware clock like so:

# hwclock --set --date "01/27/06 08:00:00" # hwclock --show Tue 27 Jan 2006 08:00:08 AM GMT -0.151718 seconds


In these examples, the hardware clock has been set using hwclock, which is then used again to verify the new hardware date and time. You can also hwclock to set the Linux system date and time date using your hardware clock's values with the Linux system date and time.

For example, to set the system time from your PC's hardware clock, use the --hctosys option like so:

# hwclock --hctosys


To set your hardware clock using the system time, use the --systohc option like so:

# hwclock --systohc


Using the system-config-date Client

Fedora's graphical X tool named system-config-date can be used to set your system date and time. Start the client by clicking the desktop menu's System Settings Date & Time menu item, or from the command line of an X11 terminal window like this:

$ system-config-date &


After you press Enter, you are asked to enter the root password. Type in the root password and click the OK button. You will then see a window, as shown in Figure 4.9.

Figure 4.9. Use Fedora's system-config-date client to set your system date and time.


Set the date and time by using the calendar and time fields. You can also have your workstation obtain updated date and time information via the network by entering a remote time server hostname in the Network Time Protocol field. This requires that the ntpd time daemon be properly configured and running.

Note

HTML documentation for using the ntpd daemon is in /usr/share/doc/ntp*/ntpd.htm (if ntpd is installed on your system).


Click the Time Zone tab to change or verify your system's time zone. The current system time zone is designated by a file named localtime in the /etc directory, and is a copy of the pertinent time zone database file under the /usr/share/zoneinfo directory. For example,

$ ls -l /etc/localtime -rw-r--r--    1 root     root         1267 Apr  1 16:39 /etc/localtime  $ ls -l /usr/share/zoneinfo/America/New_York -rw-r--r--    5 root     root         1267 Mar 13 18:00 /usr/share/zoneinfo/_America/New_York


This file changes if you make a time zone change using system-config-date.



Red Hat Fedora 5 Unleashed
Red Hat Fedora 5 Unleashed
ISBN: 067232847X
EAN: 2147483647
Year: 2004
Pages: 362

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net