Resetting the Date and Time

 < Day Day Up > 

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 Jan. 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 Red Hat'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 23, 2005 at 8 a.m.), use a command line with the month, day, hour, minute, and year, like so:

 # date 092308002003 Tue Sep 23 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 Wed 10 Sep 2003 02:17:53 PM EDT  -0.193809 seconds  

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

 # hwclock --set --date "09/23/03 08:00:00" # hwclock --show Tue 23 Sep 2003 08:00:08 AM EDT -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 will be 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 will require 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 on 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 will change if you make a time zone change using system-config-date.

     < Day Day Up > 


    Red Hat Fedora 4 Unleashed
    Red Hat Fedora 4 Unleashed
    ISBN: 0672327929
    EAN: 2147483647
    Year: 2006
    Pages: 361

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