Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 27 May 2015, 12:02
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Atomic Clock
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
ndujoe1

Joined: 04 Dec 2005
Posts: 704

PostPosted: Fri 14 Nov 2008, 10:36    Post subject:  Atomic Clock  

I inquired about a Linux version of the atomic clock, this is the response I got back from the government agency:

> Any consideration given to issuing a Linux version of your software?

Linux already has several time clients that come with the distribution.
Look at NTP, the Network Time Protocol and RDATE, which is a simpler and
less robust client. Both of these are usually part of most versions of
Linux and either of them can be used with our time servers.
We also have source code that you can use to build a simple time
client for most versions of Unix and Linux. You can get this source
code using ftp to any of our servers. For example, go to:

ftp://time-a.nist.gov/pub/daytime

and look at the files there. You can build a simple time client called
nistime by copying tcp_time_client.c, sw.c and the Makefile. The source
code for a number of other time clients is also located in this directory.
Look at the read-me files for details.

Judah Levine
Time and Frequency Division
NIST Boulder
Back to top
View user's profile Send private message 
Pizzasgood


Joined: 04 May 2005
Posts: 6270
Location: Knoxville, TN, USA

PostPosted: Fri 14 Nov 2008, 12:55    Post subject:  

Puppy has rdate already. To check the time (without setting it):
rdate -p time-a.nist.gov
To set the time:
rdate -s time-a.nist.gov

That doesn't save it back to the hardware clock. If you want to do that, run this afterward:
hwclock --systohc --localtime
(if you have the HW clock set to UTC time like me, then you'd replace --localtime with --utc - be aware that you must also track down all the calls to hwclock that Puppy makes and modify them appropriately, or else Puppy will do weird time-traveling tricks)


That's just one server. There are many. Google if you want another.


Attached is a basic program that will look at a list of servers in /etc/timeservers and try each one until it finds one that works (in case they are offline for whatever reason), then it will use that one and update both the software and hardware clocks (using localtime - modify /usr/sbin/timesync if you want to change it to utc). It will also store the address of the server, so that next time it runs it doesn't have to search unless that specific server goes down. You can run it with the command timesync or by clicking the menu entry in "Menu->Desktop->Synchronize clock with time-server". Warning: this gives you no opportunity to change your mind once you run it.

It also adds the file /etc/init.d/timesync_auto, set to non-executable. If you change it to be executable, then each time Puppy boots it will attempt to synchronize the time (by running timesync -q where the -q option suppresses the graphical notification). To disable it again, just set it non-executable.

Set executable:
chmod 755 /etc/init.d/timesync_auto
Set non-executable:
chmod 644 /etc/init.d/timesync_auto

Or you can right-click and go to 'File -> Properties' or the slightly less intuitive 'File -> Permissions'.
timesync-0.2.pet
Description  Synchronizes clock with time-server and updates hardware clock. Option to resync each boot. Chooses server from list at /etc/timeservers.
pet

 Download 
Filename  timesync-0.2.pet 
Filesize  1.46 KB 
Downloaded  388 Time(s) 

_________________
Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib

Back to top
View user's profile Send private message Visit poster's website 
alienjeff


Joined: 08 Jul 2006
Posts: 2291
Location: Winsted, CT - USA

PostPosted: Fri 14 Nov 2008, 13:29    Post subject:  

Pizzasgood wrote:
That's just one server. There are many.


http://tf.nist.gov/tf-cgi/servers.cgi

_________________
hangout: ##b0rked on irc.freenode.net
diversion: http://alienjeff.net - visit The Fringe
quote: "The foundation of authority is based upon the consent of the people." - Thomas Hooker

Back to top
View user's profile Send private message 
SirDuncan


Joined: 09 Dec 2006
Posts: 836
Location: Ohio, USA

PostPosted: Fri 14 Nov 2008, 13:34    Post subject:  

I just have this alias set in my .bashrc file,
alias set_time='rdate -s nist1-dc.WiTime.net;hwclock --systohc --localtime;rdate -p nist1-dc.WiTime.net'.
WiTIme is in Virginia, which is slightly closer to me than time-a.nist.gov's Maryland location (probably doesn't make any actual difference in speed). Pizzasgood's script is more feature packed, but I only set my time about once a year, so this simple alias works fine for me.

_________________
Be brave that God may help thee, speak the truth even if it leads to death, and safeguard the helpless. - A knight's oath
Back to top
View user's profile Send private message Visit poster's website 
Colonel Panic


Joined: 16 Sep 2006
Posts: 1646

PostPosted: Sat 14 Feb 2015, 12:56    Post subject:  

Good info, thanks all! I've just used this to reset my system clock (and will use it again in the future).

Cheers,

CP .

_________________
Acer Aspire M1610 (Core 2 Duo, 2.3 GHz), 3 GB of RAM, 320 GB hard drive running PuppEX Tahr 6.0, Puppy EmSee Ultra, OpenSUSE 13.1.1 Edu-Life, Sparky 4.0 RC1, Manjaro 0.8.12, Korora 21 Mate, VLocity RC 4.1, Exton Mint MeX and Salix 14.1 Mate.
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11421
Location: Arizona USA

PostPosted: Sat 14 Feb 2015, 15:56    Post subject:  

time.gov - NIST time <- Just click the link for the atomically correct time. Smile
Back to top
View user's profile Send private message 
Colonel Panic


Joined: 16 Sep 2006
Posts: 1646

PostPosted: Sun 15 Feb 2015, 09:45    Post subject:  

Flash wrote:
time.gov - NIST time <- Just click the link for the atomically correct time. Smile


Thanks for that one. I once tried filling an exercise book with all the Linux commands I'd need (with the commonest options I use) but the book fell to pieces Smile Time and date commands are definitely amongst them though.

_________________
Acer Aspire M1610 (Core 2 Duo, 2.3 GHz), 3 GB of RAM, 320 GB hard drive running PuppEX Tahr 6.0, Puppy EmSee Ultra, OpenSUSE 13.1.1 Edu-Life, Sparky 4.0 RC1, Manjaro 0.8.12, Korora 21 Mate, VLocity RC 4.1, Exton Mint MeX and Salix 14.1 Mate.
Back to top
View user's profile Send private message 
Moose On The Loose


Joined: 24 Feb 2011
Posts: 587

PostPosted: Tue 17 Feb 2015, 12:03    Post subject: Re: Atomic Clock  

ndujoe1 wrote:
I inquired about a Linux version of the atomic clock, this is the response I got back from the government agency:


Slightly off topic but worth pointing out:

The nice folks at NIST provide what makes this work.

Code:

#!/bin/bash
cat </dev/tcp/time.nist.gov/13


In some applications, a GPS connected to your computer can give you a quite accurate time. The trick is the kludge together something that makes the GPS's 1PPS pulse into something like an RS232 signal that you can get the interrupt for. The interrupt records the system time of the pulse and the non-interrupt code tunes the system clock to stay right on the mark.

I run a more graphically compact version of psync of my own creation. If you are running puppy on something with a small screen, you may like to give it a try. It has some added features like popping up in case of trouble and giving reasonable attempts at diagnosis messages.
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11421
Location: Arizona USA

PostPosted: Tue 17 Feb 2015, 15:47    Post subject:  

GPS time should be accurate to something on the order of nanoseconds. It's that accurate time signal that makes GPS so accurate.
Back to top
View user's profile Send private message 
Moose On The Loose


Joined: 24 Feb 2011
Posts: 587

PostPosted: Thu 19 Feb 2015, 12:17    Post subject:  

Flash wrote:
GPS time should be accurate to something on the order of nanoseconds. It's that accurate time signal that makes GPS so accurate.


Inside the GPS, the time is really good. The RS-232 output delays from the time of the fix and hence carries a time from the past and since the formatting takes a varying time, the delay varies.

The 1PPS that a GPS outputs is usually good to a microsecond. Over long times it averages to exactly 1Hz but a given pulse time can wobble about quite a bit.

Many GPS models don't output the 1PPS if they loose the signal briefly. Thus if you want to use the 1PPS, it is best to phase lock a local clock onto the 1PPS and contrive the servo so that it interpolates through a missed pulse.

Some GPS models will from time to time skip producing a fix or delay the fix an unusually long time. The code you use should deal with outliers.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0770s ][ Queries: 12 (0.0043s) ][ GZIP on ]