ntp time server select ?
Forum: Other Help Topics
Topic: ntp time server select ?
started by: bjhbjh
Posted by bjhbjh on Feb. 28 2008,01:49Running the latest DSL. Have found how to set the time via an ntp server and it all works but don't see how I can set which time server to use, or even know which one it uses by default. Can I point it to the time server of my choice some how?
Posted by roberts on Feb. 28 2008,05:48Built into DSL is a script to set time using NIST see: < http://tf.nist.gov/service/its.htm >
Looking at that script /usr/local/bin/gettime.lua you will see that it uses a default its of time-nw.nist.gov
The script also accepts a runtime paramter such that you can overridde the default with an internet time server near you.
sudo gettime.lua your_its_server_here
If your internet connection is up and available upon boot then add the command to your /opt/bootlocal.sh. sudo not needed as bootlocal.sh is run as root upon booting.
Posted by Juanito on Feb. 28 2008,16:39Would it be possible to modify the gettime script to accept a user input of the form "GMT+-n"?
The reason I ask is that (as far as I know) my time zone is not one of the choices available in dsl and, since my time stays the same all year (i.e. there is no daylight savings adjustment), I was thinking it might be possible to say something like:
$ sudo gettime.lua GMT+4
and have my machine's clock adjusted correctly
Posted by curaga on Feb. 28 2008,16:53NIST gives the UTC time. Doesn't DSL recognize the GMT+? timezones?
I mean, if you have the clock in UTC, linux can set the local time according to that.
Posted by Juanito on Feb. 28 2008,17:16
- I'm not sure if I caught the right meaning here, but if the clock is in UTC, you need to have the means to pass a time offset (i.e. tell the system where you are). At the moment, if I enter nothing and then run gettime.lua, the clock is set to GMT-4 (dsl default of US east coast I guess)
Posted by curaga on Feb. 28 2008,18:39Are you sure no included timezones match yours?
Posted by Juanito on Feb. 28 2008,19:32
- Moscow matches some of the year, but not at the moment...
Posted by curaga on Feb. 28 2008,19:40Why not remaster then with your file?
Posted by bjhbjh on Feb. 28 2008,20:05
Ok thats cool, thanks.
I could have figured this out myself I guess if I could have seen what the that the Setup/Date&Time/ViaInternetTimeServer menu item was linked to. In MS win its just a right click and properties but I can't do that here, or can I?
Is there a way to see what the DSL menu items are linked to ?
Posted by lucky13 on Feb. 28 2008,21:43
The JWM menu is in .jwmrc. It's just an XML file.
Posted by Juanito on Mar. 01 2008,18:07
- I tried copying the time file for GMT+4 to /opt and renaming it "localtime", then:
At 21:59 local time, this set the clock to 00:59pm - not being used to this am/pm stuff, I'm not totally sure whether that means 12:59 or 00:59. Anyway, it isn't 21:59...
Posted by ^thehatsrule^ on Mar. 01 2008,18:46Afaik, am/pm does not have 00: and only 12:
so something could be wrong...?
Posted by roberts on Mar. 01 2008,18:53DSL uses zoneinfo files.
You can find a complete list < here/ >
DSL also has zump and zic needed to process/setup zoneinfo files.
Download tzdata2007k.tar.gz to a working directory, unpack, and then use zic to convert to a format Linux/DSL uses.
You can "grep -i" to search for your location in the various regions (after you have unpacked them).
Once you use zic they will no longer be readable.
Posted by curaga on Mar. 01 2008,20:04isn't localtime supposed to be in /etc by the way?
Posted by Juanito on Mar. 02 2008,09:42
- it actually said a couple of minutes later - 01:01pm - so the mistake was made by me subtracting a couple of minutes to "avoid confusion".
/usr/share/zoneinfo/localtime -> /etc/localtime
/etc/timezone -> /KNOPPIX/etc/timezone -> /opt/timezone
...so I wasn't sure which one to use. I guess /opt/timezone uses the bootcode? Which one should I add to my backup (assuming I ever get this to work)?
- I thought GMT+4 was a zoneinfo file, it is included in the latest tzdata2007k.tar.gz file from your link (thanks BTW). Also from tzdata2007k.tar.gz:
- which explains some of my confusion...
I tried zic and zdump, but didn't get the hang of the syntax yet:
...doesn't seem to write the localtime file for "placename" and using only asia gives the whole nine yards in localtime and still in a readable format??
Posted by roberts on Mar. 02 2008,18:04For others who might be reading this thread, all of the supported locations are in /usr/share/zoneinfo. If your particular location is not supported then...
1. Make a working directory
2. Change to it
3. Get the latest zoneinfo data files
wget < ftp://elsie.nci.nih.gov/pub/tzdata2007k.tar.gz >
4. Unpack it
tar -zxvf tzdata2007k.tar.gz
5. Find your major area
6. Compile for your location, eg, asia
zic -d zoneinfo asia
7. Find your specific area
ls -l zoneinfo
8 Copy the newly created zoneinfo file, e.g.,
sudo zoneinfo/Asia/Saigon /usr/share/zoneinfo/Asia/.
or to /etc/localtime
Posted by ^thehatsrule^ on Mar. 02 2008,19:21Well if it does point to the one in opt, imo that's probably the best one to choose (along with bootlocal, etc.)
Posted by Juanito on Mar. 03 2008,14:11I tried this in dsl-3.4.11:
The UTC is correct but the time in the menu bar thing is not updated??
Posted by roberts on Mar. 03 2008,15:56Normally gettime.lua as well as setting localtime is done during the boot process and not from within X-windows.
If one runs the process from within X then restart your window manager to see the results of time in your taskbar.
Posted by WDef on Mar. 05 2008,22:41zdump on dsl always seems to give me the wrong time for any location I try, whether listed in /usr/share/zoneinfo or not? Unless I'm missing something.
This is one reason I wrote my citytime thing.
Posted by Juanito on Mar. 07 2008,10:16
- that did it, thanks for the help.
The following were added to my backup:
...though I guess only etc/localtime is required.