It is found in /bin/aux/timesync, so it is run with;
aux/timesynce
In 9Front it is automatically started during the boot process for terminals in /rc/bin/termrc, and on cpu servers from /rc/bin/cpurc.
In termrc, it is ran like this;
TIMESYNCARGS=(-rLa1000000) ... if(! ~ $terminal *vx32*){ # start timesync if it isn't running and we weren't told not to if(! ps|grep -s timesync) if(! ~ $TIMESYNCARGS '') aux/timesync $TIMESYNCARGS }
This checks to see if timesync is already running, or if it should run it at all, and give the equivalent of;
aux/timesynce -rLa1000000
The -r means to sync the time to the real time clock in the computer. The -L is to treat that time as the local time. Windows usually sets the internal clock to local, where Unix systems of set it to GMT and adjust it on display. And the -a is for accuracy in nanoseconds, to it checks the system clock every 1000000 nanoseconds.
For cpu servers, cpurc is called, and it runs this;
if(! ps|grep -s timesync){ if(~ $#ntp 0) ntp=`{ndb/query -cia sys $sysname ntp} if(~ $#ntp 0) ntp=pool.ntp.org aux/timesync -n $ntp sleep 2 }
Again, it is using ps and grep to check if timesync is already running. If it isn't, it will query the network database to see if a secific time server is listed. If none is found, it will use pool.ntp.org. In that case, it is running;
aux/timesync -n pool.ntp.org
This will fetch the time over the network from pool.ntp.org.
Timesynce will stay running in the background, and periodically update the time of the system, either reading the system clock, or fatching time from a time server.
If your system is reading the wrong time, it can be from several issues.
- You chose the wrong timezone during install.
- You are running a terminal but your system clock is not set to local time.
- You ran aux/timesync after boot without killing an already running timesync.
To fix a bad timezone setting, look in /adm/timezone/ for the file that fits the timezone you are in, and then copy it to /adm/timezone/local. You will need to be the hostowner of the system to do this. Example;
cp /adm/timezone/US_Pacific /adm/timezone/local
Running multiple timesyncs can cause your clock to jump back and forth. Since time synce runs in the background, having multiple timesyncs running means they all periodically wake up, and adjust the time with whatever settings they were given.
Most other timesync configuration issues can be solved using other scripts. Both termrc and cpurc check for other scripts on the system and run them prior to timesync. If you start timesync from those scripts, the default script will check and see timesynce already running, and skip using the default settings. termrc checks for /rc/bin/termrc.local and /cfg/$sysname/termrc, and cpurc checks for /rc/bin/cpurc.local and /cfg/$sysname/cpurc.
Some examples of custom timesync;
This is from a Raspberry Pi acting as a time server to a local network.
bind -b '#t' /dev /arm64/bin/aux/gpsfs -d /dev/eia0 -b 9600 aux/timesync -G -s /net
This Raspberry Pi has a GPS reciever attached to the uart pins. The bind is to add the uart devices '#t' to the /dev directory. aux/gpsfs is a program that will read a GPS device from a serial line as /dev/eia0, and create a filesystem so the GPS data can be accessed from files at /mnt/gps. And the aux/timesync setting are using -G to tell it to check /mnt/gps for time files from a GPS device, and the -s /net is then telling it to server ntp data on the network port in /net.
This example is a gateway or router like machine the fetch time from the internet, and also acts as a time server to local network.
#!/bin/rc #timesync only recieves on /net, but can serve on /net.alt #this swaps /net to outside and /net.alt to inside rfork mount /srv/net.in /net.alt mount /srv/net.out /net aux/timesync -s /net.alt -n pool.ntp.org
Since aux/timesynce only checks /net for a network to recieve time signals, the mounts at to make sure the outside network is found in /net, and the internal network is on /net.alt. The -s is to specify where to run the listener to serve time signals, and the -n is to specify to fetch time from pool.ntp.org.
If you are dual booting on a Linux machine that uses GMT rather than local time on the onboard clock, you can all a /rc/bin/termrc.local files and put in;
#!/bin/rc /bin/aux/timesync -ra1000000
This will keep all the other settings from the default termrc, but assumes the onboard clock is GMT rather than local time.