User Tools

Site Tools


adjusting_the_time_automatically

How to enable automatic adjusting of time

By default the Eee has no way to use automatic clock adjusting, like we all know from Windows XP and nearly any Linux distribution. Selai Kacang & Selai Usually the ntpdate command is used, but it is not installed in a default Eee environment. You can install it, as shown below, to use widely-available NTP servers, or use the rdate command which is present in all Eee installations, if you have access to an rdate server on your network. Servers offering rdate time service are much rarer than ntp servers!

Note: In editing text files as root, be very careful not to edit other parts of the operating system. The easiest text editor to use is probably kwrite, as shown below, but this does give worrying messages about running “kbuildsyscoca” when you start it. I am told this is quite safe. If you know vi commands, that is probably a quicker and less worrying way to edit text files. If you know vi, use “vi” instead of “kwrite” in what follows! Pintu dan Jendela To install ntpdate from the debian sarge repositories:

  • Go to
  • Choose the sarge (oldstable) repository
  • Choose i386 Architecture from the download table near the bottom
  • Follow the instructions near the top and add the repository to your /etc/apt/sources.list file
  • you should use an editor like kwrite or vi to edit the file, e.g.: sudo kwrite /etc/apt/sources.list
  • (the line to add is currently
  • Use the command sudo apt-get update to let your package system see ntpdate
  • Use the command sudo apt-get install ntpdate to install the package
  • If you are nervous about leaving sarge in your list of repositories, remove the line you added from /etc/apt/sources.list with your editor and run apt-get update again.

Both rdate and ntpdate connect to a time-server once, synchronize the time, and exit. In these instructions, we aim to run this command once the network is connected; this keeps the load on time-servers low, and gets you the right time every time you connect to a network. These commands do not compensate for clock drift, so you will need to run the ntpdate or rdate command regularly to keep your machine synchronized if it is never rebooted. Use the cron command to do this if you need to!

One good place for adjusting the time is the /etc/network/if-up.d/ directory. The scripts inside this directory are run each time a network interface is brought up. AFAIK it doesn't matter which interface type, so the following should work for wired, wireless and PPP connections.

At first find a timeserver near you: For the UK, for example, this would be 0.uk.pool.ntp.org.

Then open a terminal (Ctrl+Alt+T).

Use the command sudo kwrite /etc/network/if-up.d/settime to open the kwrite editor with a new file called settime in this directory.

Enter the following in the editor:

#!/bin/sh
/usr/sbin/ntpdate 0.uk.pool.ntp.org

if using ntpdate, or, if you are using rdate:

#!/bin/sh
/usr/sbin/rdate -s ptbtime1.ptb.de

Instead of ptbtime1.ptb.de or 0.uk.pool.ntp.org you should use your nearest timeserver.

Save the file (using the kwrite menu, or ZZ if you use vi)

Now the file must be marked executable:

sudo chmod +x /etc/network/if-up.d/settime

That's it.

To test, set the clock to a wrong time using the Settings → Date / Time. Then switch back to the console and run the command manually:

sudo /etc/network/if-up.d/settime

The time should be synchronised after the command is finished. Running it this way also lets you see any error-messages, if the server you have chosen is not available, so that you can fix it.

For further tests switch the wireless interface off and back on or just restart the Eee.

adjusting_the_time_automatically.txt · Last modified: 2013/03/20 09:30 by gerrardz