Set Clock

From INIwiki
(Redirected from SetClock)
Jump to: navigation, search

Setting your timezone The timezone under Linux is set by a symbolic link from /etc/localtime 1 to a file in the /usr/share/zoneinfo 2 directory that corresponds with what timezone you are in. For example, since I'm in South Australia, /etc/localtime is a symlink to /usr/share/zoneinfo/Australia/South. To set this link, type:

ln -sf /usr/share/zoneinfo/your/zone /etc/localtime

For MTN time it would be;

ln -sf /usr/share/zoneinfo/America/Denver /etc/localtime

For GMT time use:

ln -sf /usr/share/zoneinfo/GMT /etc/localtime

For UTC use:

ln -sf /usr/share/zoneinfo/UTC /etc/localtime

Replace your/zone with something like Australia/NSW or Australia/Perth. Have a look in the directories under /usr/share/zoneinfo to see what timezones are available.

Date, set date ( as root )

date -s 'Sat May 24 14:43:00 PDT 2003' 
[1] This assumes that /usr/share/zoneinfo is linked to /etc/localtime as it is under Red Hat Linux.
[2] On older systems, you'll find that /usr/lib/zon

While logged in as root do the following:

1. Type "date". 
2. You should see some variation of" 
   "Wed Nov 24, 9:29:17 EST 1999" 
3. To change the time type(as an example): 
   date -s 10:10 
4. The system response will be: 
   "Wed Nov 24, 10:10:02 EST 1999" 
5. Then if you want to set the hardware(BIOS) clock so the system will keep the time when it reboots type: 
   clock -w 
   or 
   setclock 

[edit] Sources:

Also see Network Time Protocol
http://www.comptechdoc.org/os/linux/usersguide/linux_ugtime.html
http://www.linuxsa.org.au/tips/time.html
Debian Specific: http://www.oreilly.com/catalog/debian/chapter/book/ch07_05.html
Personal tools