Time: Difference between revisions

From Braindump
Jump to navigation Jump to search
 
(54 intermediate revisions by the same user not shown)
Line 6: Line 6:
  UTC+3h is UTC+2h + summer time  
  UTC+3h is UTC+2h + summer time  
  EET+daylight saving time = EEST
  EET+daylight saving time = EEST
https://www.iana.org/time-zones


=== The beginning of time ===
tzcode2025a.tar.gz (301.3kb) is added in Linux From Scratch as part of GLIBC
1847: GMT
Time zone were introduced when rail travel spanned multiple timezones. GMT => TAI => UTC


1952:
https://linuxfromscratch.org/lfs/view/stable-systemd/chapter08/glibc.html


1958:
=== Daylight Saving Time ===
TAI = UT2
The dumbest thing in the modern day. A clock should be stable. Instead of shifting the clock, we should agree on changing the start times of certain events. In the winter you can shift work times by an hour and spreading the load. With modern communications it must be a lot easier to spread the load on the transport systems and electricity grid by making conscious decisions based on information freely available. I do not want to sit in a traffic jam with millions of others and I do not want to pay for peak usage when we can spread the load fairly. Changing the clocks gives me multiple headaches!


1967: Cs-133
'''STOP DAYLIGHT SAVING'''
A second was defined by the 13th General Conference on Weights and Measures: the duration of 9 192 631 770 cycles of microwave light absorbed or emitted by the hyperfine transition of cesium-133 atoms in their ground state undisturbed by external fields.


ET Ephemeris Time  
=== The beginning of time keeping ===
1977:
Observed Time
 
* apparent solar time
* mean solar time
* sidereal time
 
Apparent time, the earth wobbles and the sun will appear to make an diurnal motion around a barycenter, mean solar time averages this out. sidereal time measures the rotation of the earth excluding the rotation from the earth around the sun (3m56s shorter than a day 24h/365.25d)
 
Sundial, Hourglass, Waterclock
 
Coordinated Time
{| class="wikitable"
|+
!
!
!
!
|-
|1493
|Leonardo da Vinci
|Pendulum
|
|-
|1582
|Galileo Galilei
|
|
|-
|1656
|Christiaan Huygens
|Pendulum clock
|
|-
|1714
|Jeremy Tacker
|Chronometer
|
|-
|1730
|John Harrison
|Marine Chronometer
|Langitude could be measured for marine navigation by keeping exact time
|-
|1847
|Royal Observatory
|GMT
|Time zone were introduced when rail travel spanned multiple timezones
|-
|1952
|ITU-R
|TAI = UT1 = UTC
|UT1 observed solar time
TAI is international atomic time. UT + leapseconds
|-
|1958
|
|TAI = UT2
|Standard time, observed v.s. coordinated.
UTC Coordinated Universal Time is an atomic time scale designed to approximate Universal Time.
UTC differs from TAI by an integral number of seconds
TAI International Atomic Time (primary realisation of Terrestrial Time)
|-
|1967
|BIPM
|
|13th General Conference on Weights and Measures
Cs-133:9 192 631 770 cycles of microwave light absorbed or emitted by the hyperfine transition of cesium-133 atoms in their ground state undisturbed by external fields.
|-
|1977
|
|ET
|Ephemeris Time
1.0003725 TT = 1977 January 1.0000000 TAI
1.0003725 TT = 1977 January 1.0000000 TAI
|}


=== Time Formats ===
=== Time Formats ===
Line 30: Line 100:
  TAI is international atomic time. UT + leapseconds
  TAI is international atomic time. UT + leapseconds
  UTC is Universal Coordinated Time
  UTC is Universal Coordinated Time
SI seconds (by BIPM)
UTC (by ITU-R)
BIH/IERS is responsible for leap seconds
  ET - TAI = 32.184 seconds
  ET - TAI = 32.184 seconds
  ET - UT = ΔT
  ET - UT = ΔT
TT Terrestrial Time (new ET) a coordinate time scale at Earth's surface


TT  Terrestrial Time (new ET) a coordinate time scale at Earth's surface
  UT Universal Time
  UT Universal Time
  UT is based on sidereal time, but with a scaling factor and other adjustments to make them closer to solar time.
  UT is based on sidereal time, but with a scaling factor and other adjustments to make them closer to solar time.
  UT = UTC / UT1
  UT = UTC / UT1
  UT0 is the rotational time observed as the diurnal motion of stars or extraterrestrial radio sources.
  UT0 is the rotational time observed as the diurnal motion of stars or extraterrestrial radio sources.
  UT1 is computed by correcting UT0 for the effect of polar motion
  UT1 is computed by correcting UT0 for the effect of polar motion
Line 49: Line 112:
  UT2R is a smoothed version of UT1, incorporating both the seasonal corrections of UT2 and the tidal corrections of UT1R
  UT2R is a smoothed version of UT1, incorporating both the seasonal corrections of UT2 and the tidal corrections of UT1R


UNIX TIME seconds since 0:00 1 jan 1970
SI seconds (by BIPM)
UTC (by ITU-R)
BIH/IERS is responsible for leap seconds
 
UNIX TIME seconds since 0:00 1 January 1970
The "posix" version is based on the Coordinated Universal Time (UTC).
The "right" version is based on the International Atomic Time (TAI), and it includes the leap seconds.


Bulletin on the corrections between UTC and TAI


Standard time, observed v.s. coordinated. UTC Coordinated Universal Time is an atomic time scale designed to approximate Universal Time. UTC differs from TAI by an integral number of seconds
http://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat
TAI International Atomic Time (primary realisation of Terrestrial Time)


- The "posix" version is based on the Coordinated Universal Time (UTC).
''from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s''
- The "right" version is based on the International Atomic Time (TAI), and it includes the leap seconds.


Bulletin on the corrections between UTC and TAI
https://hpiers.obspm.fr/eoppc/bul/bulc/Leap_Second.dat
http://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat
from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s


Bulletin T on difference between UTC and UTC/NIST (synchronization delay/deviation)
Bulletin T on difference between UTC and UTC/NIST (synchronization delay/deviation)
https://www.bipm.org/en/time-ftp/other-products
https://www.bipm.org/en/time-ftp/other-products


NIST runs NTP servers, most are UTC +/- a deviation in nanoseconds. 2 NTP servers report UT1.
=== Programming Language ===
ISO 8601 Date Formats, 2024-12-13
 
2024-02-01T22:38:10−07:00
 
https://www.rfc-editor.org/rfc/rfc3339.html
 
 
 
UNIX
 
date %y%m%c
 
Unix Time seconds since January 1970
 
C
 
Java: DateTime, Joda
 
https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html
 
JavaScrypt
 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
 
MYSQL / MARIADB
 
Timestamp
 
https://docs.oracle.com/cd/E17952_01/mysql-5.7-en/date-and-time-functions.html
 
Oracle
 
Microsoft Excel


The NIST servers will compute UT1 time by adding the DUT1 value for any MJD to UTC(NIST). The value used for DUT1 will be the value determined by http://www.iers.org
https://support.microsoft.com/en-us/office/date-function-e36c0c8c-4104-49da-ab83-82328b832349


=== Why circle 360, 24 timezones ===
=== Why circle 360, 24 timezones ===
The world turns around it's axis 365 times before it makes a circle around the sun.1 degree per day. Babylonians used base 60 and 6x 60 = 360 so it's neatly divisable.
https://www.iflscience.com/why-are-there-360-degrees-in-a-circle-instead-of-something-useful-like-100-68919
https://www.iflscience.com/why-are-there-360-degrees-in-a-circle-instead-of-something-useful-like-100-68919


MST mean solar time
 
24-hour per day ancient Egyptians who divided day-time into 10 hours they measured with devices such as shadow clocks, and added a twilight hour at the beginning and another one at the end of the day-time.
 
https://www.abc.net.au/science/articles/2011/11/15/3364432.htm
 
=== Summer time ===
 
To increase the hours of sunlight in the evening, summertime shifts the clock an hour forward in the sprint time and returns to normal in autumn, but moving an hour backwards.
 
This is a stupid habit which could have been easily accomplished by agreeing to shift starting times of certain events, rather than messing around with the clock. For instance go to school at 8:00 in the summer and 8:30 in the winter. With modern communication and technology it should be easy to spread out the peaks by better planning. But no! My microwave doesn't know what time it is, my radio controlled clocks can't hear frankfurt that well and clocks are now confused. Working with different timezones where diffent sumertime begin and endtimes are used and shift on the southern hemisphere to a different directions, makes me jetlagged in my own home.
 
Summer time is stupid. Stop shifting the clock and agree that in spring we get up one hour earlier.
 
=== MST mean solar time ===


The length of the mean solar day is increasing due to the tidal acceleration of the Moon by Earth, and the corresponding deceleration of the Earth by the Moon.
The length of the mean solar day is increasing due to the tidal acceleration of the Moon by Earth, and the corresponding deceleration of the Earth by the Moon.
Line 79: Line 194:
  +1.7 msec / 100 years
  +1.7 msec / 100 years


Mean Sidereal measured against a away star. Time mean sidereal day is about 23 h 56 m 4.1 s in length
Mean Sidereal measured against a far away star. Time mean sidereal day is about 23 h 56 m 4.1 s in length


== Computer Clock ==
== Computer Clock ==
Line 94: Line 209:
== Which clock? ==
== Which clock? ==


There is a rtc / hardwareclock that runs even when the computer is switched off.
An RTC / realtime hardware clock runs even when the computer is switched off. In the CPU a system clock loads the time from the hardware clock on startup, and updates the hardware clock on shutdown. NTP clocks on the internet provide a reliable time reference, some are directly linked to an atom clock. GPS satellites send precise time information and they have onboard atom clocks.  
There is a systemclock in the CPU that loads the hardware clock on startup, and updates the hardwareclock on shutdown.
There are NTP clocks on the internet providing a stable time reference.


== Hardwareclock ==
== Hardware clock ==
http://support.ntp.org/bin/view/Support/KnownOsIssues
http://support.ntp.org/bin/view/Support/KnownOsIssues


There are a few different available hardware clocks in modern PC's. The linux kernel will use one as the clocksource for interupts and also will use one systemclock as the source.
There are a few different available hardware clocks in modern PC's. The linux kernel will use one as the clocksource for interupts and also will use one system clock as the source.


  cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  cat /sys/devices/system/clocksource/clocksource0/current_clocksource
Line 110: Line 223:


The clocksource can be selected in the kernel options at bootup, so you can add clocksource to the kernel options.
The clocksource can be selected in the kernel options at bootup, so you can add clocksource to the kernel options.
  vi /boot/grub/menu.lst
  vi /etc/default/grub.conf
  kernel ... clocksource=hpet
  GRUB_CMDLINE_LINUX_DEFAULT="quiet splash clocksource=hpet"
 
update-grub
The hardwareclock can be read or written from/to the systemclock using
The hardwareclock can be read or written from/to the systemclock using
  hwclock --systohc
  hwclock --systohc
Line 129: Line 242:
  FREQ=4007068
  FREQ=4007068


Once the tick has been adjusted, and NTP is working the systemclock will be more accurate than the hardware clock. So the drift rate of the hardware clock will be calculated and stored. At startup it is calculated how much time the hardware clock has run undisciplined and the clocks will be corrected by the drift rate calculation.
https://linuxize.com/post/how-to-set-or-change-timezone-in-linux/
 
Timezone, timedatectl
 
Once the tick has been adjusted and NTP is working the systemclock will be more accurate than the hardware clock. So the drift rate of the hardware clock will be calculated and stored. At startup it is calculated how much time the hardware clock has run undisciplined and the clocks will be corrected by the drift rate calculation.
  cat /etc/adjtime
  cat /etc/adjtime
Intel Software Develper Manual
<nowiki>https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html</nowiki>
<nowiki>https://cdrdv2.intel.com/v1/dl/getContent/671200</nowiki>
CPU Identification, Instruction CPUID, Opcode 0F A2
MOV EAX, 15H
CPUID
TSC Time Stamp Count (Bit 4 in EDX)
If EBX[31:0] is 0, the TSC/”core crystal clock” ratio is not enumerated.
EBX[31:0]/EAX[31:0] indicates the ratio of the TSC frequency and the core crystal clock frequency.
If ECX is 0, the nominal core crystal clock frequency is not enumerated.
“TSC frequency” = “core crystal clock frequency” * EBX/EAX.
The core crystal clock may differ from the reference clock, bus clock, or core clock frequencies.
EAX Bits 31-00: An unsigned integer which is the denominator of the TSC/”core crystal clock” ratio.
EBX Bits 31-00: An unsigned integer which is the numerator of the TSC/”core crystal clock” ratio.
ECX Bits 31-00: An unsigned integer which is the nominal frequency of the core crystal clock in Hz.
EDX Bits 31-00: Reserved = 0
Read time stamp counter, Instruction RDTSC, Opcode 0F 31 RDTSC
<nowiki>https://github.com/coreutils/coreutils/blob/master/src/date.c</nowiki>
clock_gettime
SYSDEP_GETTIME
Linux Syscalls in Glibc
<nowiki>https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/syscalls.list;hb=HEAD</nowiki>
<nowiki>https://stackoverflow.com/questions/52616271/timing-clocks-in-the-linux-kernel</nowiki>
Documentation/timers/timekeeping.txt
<nowiki>https://people.cs.rutgers.edu/~pxk/416/notes/c-tutorials/gettime.html</nowiki>
wristwatch time
stopwatch time
clock_gettime
CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC and CLOCK_BOOTTIME
<nowiki>https://www.kernelconfig.io/config_common_clk</nowiki>
Common Clock Framework
include/linux/clk.h
== Ethernet TSN ==
https://en.wikipedia.org/wiki/Time-Sensitive_Networking
== PTP ==
IEEE 1588-2019
ptp4l
phc2sys


== NTP ==
== NTP ==
https://timeanddate.com/
https://gist.github.com/mutin-sa/eea1c396b1e610a2da1e5550d94b0453
 
NIST runs NTP servers, most are UTC +/- a deviation in nanoseconds. 2 NTP servers report UT1.
 
https://www.time.gov/
 
The NIST servers will compute UT1 time by adding the DUT1 value for any MJD to UTC(NIST).
 
'''Leap Seconds'''
 
The value used for DUT1 will be the value determined by http://www.iers.org
 
DUT1 = UT1 − UTC
 
UTC is maintained via leap seconds, such that DUT1 remains within the range −0.9 s < DUT1 < +0.9 s.
 
https://www.iers.org/IERS/EN/Publications/Bulletins/bulletins.html
 
"''from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s''"
 
NTP
 
The NTP daemon will use clocksources from the internet to dicipline the system clock. it will first poll the time servers every 64 seconds until it has enough data to check less frequently (every 11 minutes). After a few polls NTP decides which clocksources are reliable (+) and which one it selects as the best (*) it will use. NTP will then slew the clock into the correct time, so a clock which is running 500ms fast will be slowly brought back to the correct time. The longer a clock is disciplined by NTP the more accurate it will be. network traffic will cause a delay between the client and the server, because the network latency increases, which will decrease accuracy. The ntp drift is stored in the driftfile so that the drift can be monitored.
 
=== Chrony ===
https://ubuntu.com/server/docs/how-to-serve-the-network-time-protocol-with-chrony
 
https://www.dna.fi/yrityksille/dna-verkko/ipv6-yhteydet
chronyc makestep
 
chronyc sources
chronyc sourcestats
chronyc serverstats
chronyc tracking
 
chronyc clients
chronyc add server ntp.dnafinland.fi
chronyc ntpdata
 
=== NTP servers and pools ===
 
https://www.bipm.org/en/cipm-mra/participation


the NTP daemon will use clocksources from the internet to dicipline the system clock. it will first poll the time servers every 64 seconds until it has enough data to check less frequently (every 11 minutes). After a few polls NTP decides which clocksources are reliable (+) and which one it selects as the best (*) it will use. NTP will then slew the clock into the correct time, so a clock which is running 500ms fast will be slowly brought back to the correct time. The longer a clock is diciplined by NTP the more accurate it will be. network traffic will cause a delay between the client and the server, because the network latency increases, which will decrease accuracy. The ntp drift is stored in the driftfile so that the drift can be monitored
A pool is a list of servers listed by DNS.


https://www.vttresearch.com/fi/palvelut/suomen-aika-ntp-palvelu
https://www.vttresearch.com/fi/palvelut/suomen-aika-ntp-palvelu


  pool time.mikes.fi
  server time.mikes.fi
 
https://apps.db.ripe.net/db-web-ui/query?bflag=false&dflag=false&rflag=true&searchtext=194.100.49.139&source=RIPE
 
https://lg.telia.net/?type=bgp&router=fi-hkitm-asbr1.fi&address=194.100.49.139


sidn time.nl
sidn time.nl
  pool ntp.time.nl
  pool ntp.time.nl
nist time.nist.gov
pool time.nist.gov
time.cloudflare.com
pool time.cloudflare.com


https://developers.google.com/time/smear
https://developers.google.com/time/smear
time.google.com
time.google.com
pool time.google.com
https://aws.amazon.com/blogs/aws/look-before-you-leap-the-coming-leap-second-and-aws/
https://aws.amazon.com/blogs/aws/look-before-you-leap-the-coming-leap-second-and-aws/
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html
time.aws.com
time.aws.com
pool time.aws.com
IPv4:169.254.169.123
IPv6: fd00:ec2::123 (Nitro only)


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


IPv6
=== NTS ===
Authenticated NTP RFC 8915
https://fedoramagazine.org/secure-ntp-with-nts/
 
server sth1.nts.netnod.se nts iburst
 
server sth2.nts.netnod.se nts iburst
 
https://blog.cloudflare.com/secure-time
 
https://www.netnod.se/knowledge-base/What-is-Network-Time-Security-NTS
 
https://fedoramagazine.org/secure-ntp-with-nts/
 
https://safran-navigation-timing.com/how-to-protect-your-ntp-server-from-cyberattacks/
 
=== AWS and Google clock slewing ===
for the TAI correction, the AWS and Google NTP services slew the clock so the change is smeared out over a day, otherwise the clock could reach  23:59:60, which some applications (databases mainly) may not be able to cope.
 
Aliyun NTP
 
https://help.aliyun.com/zh/ecs/user-guide/alibaba-cloud-ntp-server
 
=== IPv6 ===
https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml
https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml
  FF0X::101 Network Time Protocol (NTP)
  FF0X::101 Network Time Protocol (NTP)
Line 166: Line 440:
  E Global scope
  E Global scope
  F Reserved
  F Reserved
=== MRTG ===
http://satsignal.eu/ntp/NTPandMRTG.html
https://store.uputronics.com/index.php?route=product/product&product_id=92
chrony can step the clock on the first 3 updates if the clock is off by more than one second. When the system doesn't have an RTC clock, this can be useful
makestep 1.0 3
When the system does have an RTC clock, chrony can sync the time
rtcsync


=== OpenNTP ===
=== OpenNTP ===
Line 212: Line 499:


  http://www.ntp.org/ntpfaq/NTP-s-trouble.htm
  http://www.ntp.org/ntpfaq/NTP-s-trouble.htm
=== Chrony ===
chronyc makestep
chronyc sources
chronyc sourcestats
chronyc serverstats
chronyc tracking
chronyc clients
chronyc add server ntp.dnafinland.fi
chronyc ntpdata
http://satsignal.eu/ntp/NTPandMRTG.html
https://store.uputronics.com/index.php?route=product/product&product_id=92
=== AWS and Google clock slewing ===
for the TAI correction, the AWS and Google NTP services slew the clock so the change is smeared out over a day, otherwise the clock could reach  23:59:60, which some applications (databases mainly) may not be able to cope.


== Windows Time ==
== Windows Time ==


https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings
https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings
ms-sntp


  net stop w32time
  net stop w32time
Line 251: Line 520:
This seems to exist, but is not actually chosen?
This seems to exist, but is not actually chosen?
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers
  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers
== Android ==
platform-tools/adb shell
settings get global ntp_server
settings put global ntp_server 10.0.0.5
settings put global auto_time 0
settings put global auto_time 1
settings get global auto_time


== GPS Time ==
== GPS Time ==
A sync source are the 31 [https://www.gps.gov/systems/gps/space/ 31 operational GPS satellites]. They all have a cesium or rubidium atomic clock on board and provide. Not all GPS receivers export a PPS pulse per second which can be used by the GPSD to synchronize to NTPD, the ones that do can have different accuracy based on the gps chip and the mode used. The generic NMEA in one line ASCII is less accurate than any propitiatory binary protocol.
GPS as a precise sync source, there are the [https://www.gps.gov/systems/gps/space/ 31 operational GNSS], [https://www.gsc-europa.eu/system-service-status/constellation-information 25 Galileo] and [https://gssc.esa.int/navipedia/index.php/GLONASS_Space_Segment 24 Glonass] Satellites
 
They all have a cesium or rubidium atomic clock on board and provide. Not all GPS receivers export a PPS pulse per second which can be used by the GPSD to synchronize to NTPD, the ones that do can have different accuracy based on the gps chip and the mode used. The generic NMEA in one line ASCII is less accurate than any propitiatory binary protocol.


ntpd will use a pseudo-ip address 127.127.1.34 which is a local loopback address, as network socket to the gps driver (gpsd)
ntpd will use a pseudo-ip address 127.127.1.34 which is a local loopback address, as network socket to the gps driver (gpsd)
Line 277: Line 557:
http://www.usglobalsat.com/download/46/em406a_ug.pdf
http://www.usglobalsat.com/download/46/em406a_ug.pdf


==== Beitan BN-280 ====
In 2019 I bough a Beitan BN-280 with a U-Blox M8N chip with a PPS pulse per second line. I used an arduino uno with SoftwareSerial on pin 10 and 11 to the gps chip.
In 2019 I bough a Beitan BN-280 with a U-Blox M8N chip with a PPS pulse per second line. I used an arduino uno with SoftwareSerial on pin 10 and 11 to the gps chip.
http://arduino.cc/en/Reference/SoftwareSerial
http://arduino.cc/en/Reference/SoftwareSerial
Line 282: Line 563:
https://maker.pro/raspberry-pi/tutorial/how-to-use-a-gps-receiver-with-raspberry-pi-4
https://maker.pro/raspberry-pi/tutorial/how-to-use-a-gps-receiver-with-raspberry-pi-4


https://www.qso.com.ar/datasheets/Receptores%20GNSS-GPS/BN-280%20GPS%20Module%20Datasheet.pdf
https://austinsnerdythings.com/2021/04/19/microsecond-accurate-ntp-with-a-raspberry-pi-and-pps-gps/


# PPS
https://katron.org/blog/2021/10/raspberry-pi-gps/
# GND
# TX
# RX
# 3-5V


https://www.qso.com.ar/datasheets/Receptores%20GNSS-GPS/BN-280%20GPS%20Module%20Datasheet.pdf
{| class="wikitable"
|+
!
!
!
!
|-
|1
|PPS
|
|Yellow
|-
|2
|GND
|
|Black
|-
|3
|TX
|
|White
|-
|4
|RX
|
|Green
|-
|5
|VCC
|3 to 5V
|Red
|-
|6
|NC
|
|Grey
|}
https://www.u-blox.com/en/product/neo-m8-series#tab-documentation-resources
https://www.u-blox.com/en/product/neo-m8-series#tab-documentation-resources


Through U-Center and the NMEA set it can be tested and configured on windows. It's also possible to switch to U-Blox binary
Through U-Center and the NMEA set it can be tested and configured on windows. It's also possible to switch to U-Blox binary
=== Ethernet TSN ===
https://en.wikipedia.org/wiki/Time-Sensitive_Networking


NTRIP, RTCM over IP
RTK
https://github.com/tomojitakasu/RTKLIB.git
https://www.maanmittauslaitos.fi/en/finpos/rtk
U-Blox ZED-F9P
=== GPS Commands ===
=== GPS Commands ===
  setSerialPort
  setSerialPort
  $PSRF100,0
  $PSRF100,0
Line 319: Line 641:
  Disable SBAS(WAAS/EGNOS)
  Disable SBAS(WAAS/EGNOS)
  $PSRF151,00*0E
  $PSRF151,00*0E
=== Timestamp Authority ===
RFC 3161
ETSI EN 319 421, ETSI EN 319 422
https://blog.ascertia.com/timestamp-authority-server-the-must-have-features
=== Roughtime ===
tlsdate was a parasitic method of retrieve an approximate initial time from tls servers. Since TLS 1.3, the server hello is optional and the server may not tell the time
A new initiative is Google Roughtime, with Cloudflare documenting how to use it in a blog and with a GOLANG code, (rust and java clients exist)
https://datatracker.ietf.org/doc/draft-ietf-ntp-roughtime/07/
git clone <nowiki>https://github.com/cloudflare/roughtime</nowiki>
go get -u github.com/cloudflare/roughtime
go install github.com/cloudflare/roughtime...
getroughtime -ping roughtime.cloudflare.com:2002 -pubkey gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=
go run main.go -ping roughtime.cloudflare.com:2002 -pubkey gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=
dig TXT roughtime.cloudflare.com | grep -oP 'TXT\s"\K.*?(?=")'
go run main.go -ping roughtime.cloudflare.com:2002 -pubkey gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=
go run main.go -ping roughtime.dnov.se:2002 -pubkey hlKAFAeU+xDZ1+9eVgrXel+m3sRiSlzoqCsqL9WoRB0=
go run main.go -ping roughtime.int08h.com:2002 -pubkey AW5uAoTSTDfG5NfY1bTh08GUnOqlRb+HVhbJ3ODJvsE=
go run main.go -ping roughtime.se:2002 -pubkey S3AzfZJ5CjSdkJ21ZJGbxqdYP/SoE8fXKY0+aicsehI=
go run main.go -ping time.0xt.ca:2002 -pubkey iBVjxg/1j7y1+kQUTBYdTabxCppesU/07D4PMDJk2WA=
go run main.go -ping roughtime.chainpoint.org:2002 -pubkey bbT+RPS7zKX6w71ssPibzmwWqU9ffRV5oj2OresSmhE=
go run main.go -ping roughtime.sandbox.google.com:2002 -pubkey etPaaIxcBMY1oUeGpwvPMCJMwlRVNxv51KK/tktoJTQ=
go run main.go -ping ticktock.mixmin.net:5333 -pubkey cj8GsiNlRkqiDElAeNMSBBMwrAl15hYPgX50+GWX/lA=
None of these server respond or use the correct version
=== PHP ===
It's probably easier to implement a time reporting function and tie it to a valid TLS certificate
https://janmg.com/time.php
<?php
  header('Content-Type:text/plain');
  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
  header("Cache-Control: post-check=0, pre-check=0", false);
  header("Pragma: no-cache");
  echo gmdate("Y-m-d  H:i:s");
?>

Latest revision as of 06:46, 4 February 2025

Timeanddate.com

https://timeanddate.com/

Timezone date

TZ=Europe/Helsinki
UTC+3h is UTC+2h + summer time 
EET+daylight saving time = EEST

https://www.iana.org/time-zones

tzcode2025a.tar.gz (301.3kb) is added in Linux From Scratch as part of GLIBC

https://linuxfromscratch.org/lfs/view/stable-systemd/chapter08/glibc.html

Daylight Saving Time

The dumbest thing in the modern day. A clock should be stable. Instead of shifting the clock, we should agree on changing the start times of certain events. In the winter you can shift work times by an hour and spreading the load. With modern communications it must be a lot easier to spread the load on the transport systems and electricity grid by making conscious decisions based on information freely available. I do not want to sit in a traffic jam with millions of others and I do not want to pay for peak usage when we can spread the load fairly. Changing the clocks gives me multiple headaches!

STOP DAYLIGHT SAVING

The beginning of time keeping

Observed Time

  • apparent solar time
  • mean solar time
  • sidereal time

Apparent time, the earth wobbles and the sun will appear to make an diurnal motion around a barycenter, mean solar time averages this out. sidereal time measures the rotation of the earth excluding the rotation from the earth around the sun (3m56s shorter than a day 24h/365.25d)

Sundial, Hourglass, Waterclock

Coordinated Time

1493 Leonardo da Vinci Pendulum
1582 Galileo Galilei
1656 Christiaan Huygens Pendulum clock
1714 Jeremy Tacker Chronometer
1730 John Harrison Marine Chronometer Langitude could be measured for marine navigation by keeping exact time
1847 Royal Observatory GMT Time zone were introduced when rail travel spanned multiple timezones
1952 ITU-R TAI = UT1 = UTC UT1 observed solar time

TAI is international atomic time. UT + leapseconds

1958 TAI = UT2 Standard time, observed v.s. coordinated.

UTC Coordinated Universal Time is an atomic time scale designed to approximate Universal Time. UTC differs from TAI by an integral number of seconds TAI International Atomic Time (primary realisation of Terrestrial Time)

1967 BIPM 13th General Conference on Weights and Measures

Cs-133:9 192 631 770 cycles of microwave light absorbed or emitted by the hyperfine transition of cesium-133 atoms in their ground state undisturbed by external fields.

1977 ET Ephemeris Time

1.0003725 TT = 1977 January 1.0000000 TAI

Time Formats

GMT is Greenwich Mean Time
Z   is Zulutime
UT1 observed solar time
TAI is international atomic time. UT + leapseconds
UTC is Universal Coordinated Time
ET - TAI = 32.184 seconds
ET - UT = ΔT
TT Terrestrial Time (new ET) a coordinate time scale at Earth's surface
UT Universal Time
UT is based on sidereal time, but with a scaling factor and other adjustments to make them closer to solar time.
UT = UTC / UT1
UT0 is the rotational time observed as the diurnal motion of stars or extraterrestrial radio sources.
UT1 is computed by correcting UT0 for the effect of polar motion
UT2 is a smoothed version of UT1, filtering out periodic seasonal variations, hardly in use
UT2R is a smoothed version of UT1, incorporating both the seasonal corrections of UT2 and the tidal corrections of UT1R
SI seconds (by BIPM)
UTC (by ITU-R)
BIH/IERS is responsible for leap seconds 

UNIX TIME seconds since 0:00 1 January 1970

The "posix" version is based on the Coordinated Universal Time (UTC).
The "right" version is based on the International Atomic Time (TAI), and it includes the leap seconds.

Bulletin on the corrections between UTC and TAI

http://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat

from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s

https://hpiers.obspm.fr/eoppc/bul/bulc/Leap_Second.dat

Bulletin T on difference between UTC and UTC/NIST (synchronization delay/deviation)

https://www.bipm.org/en/time-ftp/other-products

Programming Language

ISO 8601 Date Formats, 2024-12-13

2024-02-01T22:38:10−07:00

https://www.rfc-editor.org/rfc/rfc3339.html


UNIX

date %y%m%c

Unix Time seconds since January 1970

C

Java: DateTime, Joda

https://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html

JavaScrypt

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

MYSQL / MARIADB

Timestamp

https://docs.oracle.com/cd/E17952_01/mysql-5.7-en/date-and-time-functions.html

Oracle

Microsoft Excel

https://support.microsoft.com/en-us/office/date-function-e36c0c8c-4104-49da-ab83-82328b832349

Why circle 360, 24 timezones

The world turns around it's axis 365 times before it makes a circle around the sun.1 degree per day. Babylonians used base 60 and 6x 60 = 360 so it's neatly divisable.

https://www.iflscience.com/why-are-there-360-degrees-in-a-circle-instead-of-something-useful-like-100-68919


24-hour per day ancient Egyptians who divided day-time into 10 hours they measured with devices such as shadow clocks, and added a twilight hour at the beginning and another one at the end of the day-time.

https://www.abc.net.au/science/articles/2011/11/15/3364432.htm

Summer time

To increase the hours of sunlight in the evening, summertime shifts the clock an hour forward in the sprint time and returns to normal in autumn, but moving an hour backwards.

This is a stupid habit which could have been easily accomplished by agreeing to shift starting times of certain events, rather than messing around with the clock. For instance go to school at 8:00 in the summer and 8:30 in the winter. With modern communication and technology it should be easy to spread out the peaks by better planning. But no! My microwave doesn't know what time it is, my radio controlled clocks can't hear frankfurt that well and clocks are now confused. Working with different timezones where diffent sumertime begin and endtimes are used and shift on the southern hemisphere to a different directions, makes me jetlagged in my own home.

Summer time is stupid. Stop shifting the clock and agree that in spring we get up one hour earlier.

MST mean solar time

The length of the mean solar day is increasing due to the tidal acceleration of the Moon by Earth, and the corresponding deceleration of the Earth by the Moon.

1820 86400 Seconds
+1.4 msec / 100 years
+1.7 msec / 100 years

Mean Sidereal measured against a far away star. Time mean sidereal day is about 23 h 56 m 4.1 s in length

Computer Clock

Computers have a hardware clock for longtime clock keeping and the CPU keeps track of the software clock which is used in application to tell time. The software clock and hardware clock need to be calibrated, so it needs an external clock source.

My clock was running horribly wrong on my brand new computer. It's not a weak BIOS battery and it's not because it's a brand new AMD64. Heat will make clocks 'wobble' a bit, but the real reason was that I should have calibrated the clock. NTP will not correct clocks that are off by more than 500ms / minute. (or was it 500ms)

/etc/init.d/ntp stop
ntpdate stampertje.islief.com
hwclock --systohc
adjtimex -a
/etc/init.d/ntp start

Which clock?

An RTC / realtime hardware clock runs even when the computer is switched off. In the CPU a system clock loads the time from the hardware clock on startup, and updates the hardware clock on shutdown. NTP clocks on the internet provide a reliable time reference, some are directly linked to an atom clock. GPS satellites send precise time information and they have onboard atom clocks.

Hardware clock

http://support.ntp.org/bin/view/Support/KnownOsIssues

There are a few different available hardware clocks in modern PC's. The linux kernel will use one as the clocksource for interupts and also will use one system clock as the source.

cat /sys/devices/system/clocksource/clocksource0/current_clocksource
acpi_pm
cat /sys/devices/system/clocksource/clocksource0/available_clocksource
tsc hpet acpi_pm jiffies 

The clocksource can be selected in the kernel options at bootup, so you can add clocksource to the kernel options.

vi /etc/default/grub.conf
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash clocksource=hpet"
update-grub

The hardwareclock can be read or written from/to the systemclock using

hwclock --systohc
hwclock --hctosys

The systemclock is updated every tick. A kernel generates by default roughly 100 ticks/second. To enhance the precision, the clock can be synchronized to the correct number of ticks and in my case the clock is always too slow, so I set the tick to 10003 which means that my system clock is not drifting as much as before. I previously incorrectly set the tick to 9700 causing a huge drift. adjtimex can calculate the difference between the systemclock and the hardware clock and will estimate what the tick should be. This is a very coarse setting, which can be fine tuned using NTP.

To print the current tick and freq

adjtimex -p

To adjust the tick / freq

adjtimex -a
/etc/init.d/adjtimex restart
/etc/default/adjtimex
TICK=100003
FREQ=4007068

https://linuxize.com/post/how-to-set-or-change-timezone-in-linux/

Timezone, timedatectl

Once the tick has been adjusted and NTP is working the systemclock will be more accurate than the hardware clock. So the drift rate of the hardware clock will be calculated and stored. At startup it is calculated how much time the hardware clock has run undisciplined and the clocks will be corrected by the drift rate calculation.

cat /etc/adjtime

Intel Software Develper Manual

https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html

https://cdrdv2.intel.com/v1/dl/getContent/671200

CPU Identification, Instruction CPUID, Opcode 0F A2

MOV EAX, 15H

CPUID

TSC Time Stamp Count (Bit 4 in EDX)

If EBX[31:0] is 0, the TSC/”core crystal clock” ratio is not enumerated.

EBX[31:0]/EAX[31:0] indicates the ratio of the TSC frequency and the core crystal clock frequency.

If ECX is 0, the nominal core crystal clock frequency is not enumerated.

“TSC frequency” = “core crystal clock frequency” * EBX/EAX.

The core crystal clock may differ from the reference clock, bus clock, or core clock frequencies.

EAX Bits 31-00: An unsigned integer which is the denominator of the TSC/”core crystal clock” ratio.

EBX Bits 31-00: An unsigned integer which is the numerator of the TSC/”core crystal clock” ratio.

ECX Bits 31-00: An unsigned integer which is the nominal frequency of the core crystal clock in Hz.

EDX Bits 31-00: Reserved = 0

Read time stamp counter, Instruction RDTSC, Opcode 0F 31 RDTSC

https://github.com/coreutils/coreutils/blob/master/src/date.c

clock_gettime

SYSDEP_GETTIME

Linux Syscalls in Glibc

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/syscalls.list;hb=HEAD

https://stackoverflow.com/questions/52616271/timing-clocks-in-the-linux-kernel

Documentation/timers/timekeeping.txt

https://people.cs.rutgers.edu/~pxk/416/notes/c-tutorials/gettime.html

wristwatch time

stopwatch time

clock_gettime

CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC and CLOCK_BOOTTIME

https://www.kernelconfig.io/config_common_clk

Common Clock Framework

include/linux/clk.h

Ethernet TSN

https://en.wikipedia.org/wiki/Time-Sensitive_Networking

PTP

IEEE 1588-2019

ptp4l

phc2sys

NTP

https://gist.github.com/mutin-sa/eea1c396b1e610a2da1e5550d94b0453

NIST runs NTP servers, most are UTC +/- a deviation in nanoseconds. 2 NTP servers report UT1.

https://www.time.gov/

The NIST servers will compute UT1 time by adding the DUT1 value for any MJD to UTC(NIST).

Leap Seconds

The value used for DUT1 will be the value determined by http://www.iers.org

DUT1 = UT1 − UTC

UTC is maintained via leap seconds, such that DUT1 remains within the range −0.9 s < DUT1 < +0.9 s.

https://www.iers.org/IERS/EN/Publications/Bulletins/bulletins.html

"from 2017 January 1, 0h UTC, until further notice : UTC-TAI = -37 s"

NTP

The NTP daemon will use clocksources from the internet to dicipline the system clock. it will first poll the time servers every 64 seconds until it has enough data to check less frequently (every 11 minutes). After a few polls NTP decides which clocksources are reliable (+) and which one it selects as the best (*) it will use. NTP will then slew the clock into the correct time, so a clock which is running 500ms fast will be slowly brought back to the correct time. The longer a clock is disciplined by NTP the more accurate it will be. network traffic will cause a delay between the client and the server, because the network latency increases, which will decrease accuracy. The ntp drift is stored in the driftfile so that the drift can be monitored.

Chrony

https://ubuntu.com/server/docs/how-to-serve-the-network-time-protocol-with-chrony

https://www.dna.fi/yrityksille/dna-verkko/ipv6-yhteydet

chronyc makestep
chronyc sources
chronyc sourcestats
chronyc serverstats
chronyc tracking
chronyc clients
chronyc add server ntp.dnafinland.fi
chronyc ntpdata

NTP servers and pools

https://www.bipm.org/en/cipm-mra/participation

A pool is a list of servers listed by DNS.

https://www.vttresearch.com/fi/palvelut/suomen-aika-ntp-palvelu

server time.mikes.fi

https://apps.db.ripe.net/db-web-ui/query?bflag=false&dflag=false&rflag=true&searchtext=194.100.49.139&source=RIPE

https://lg.telia.net/?type=bgp&router=fi-hkitm-asbr1.fi&address=194.100.49.139

sidn time.nl

pool ntp.time.nl

nist time.nist.gov

pool time.nist.gov

time.cloudflare.com

pool time.cloudflare.com

https://developers.google.com/time/smear

time.google.com

pool time.google.com

https://aws.amazon.com/blogs/aws/look-before-you-leap-the-coming-leap-second-and-aws/

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html

time.aws.com

pool time.aws.com

IPv4:169.254.169.123

IPv6: fd00:ec2::123 (Nitro only)

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

NTS

Authenticated NTP RFC 8915 https://fedoramagazine.org/secure-ntp-with-nts/

server sth1.nts.netnod.se nts iburst

server sth2.nts.netnod.se nts iburst

https://blog.cloudflare.com/secure-time

https://www.netnod.se/knowledge-base/What-is-Network-Time-Security-NTS

https://fedoramagazine.org/secure-ntp-with-nts/

https://safran-navigation-timing.com/how-to-protect-your-ntp-server-from-cyberattacks/

AWS and Google clock slewing

for the TAI correction, the AWS and Google NTP services slew the clock so the change is smeared out over a day, otherwise the clock could reach 23:59:60, which some applications (databases mainly) may not be able to cope.

Aliyun NTP

https://help.aliyun.com/zh/ecs/user-guide/alibaba-cloud-ntp-server

IPv6

https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml

FF0X::101 	Network Time Protocol (NTP)
0 	Reserved
1 	Interface-Local scope
2 	Link-Local scope
3 	Realm-Local scope
4 	Admin-Local scope
5 	Site-Local scope
6-7 	Unassigned
8 	Organization-Local scope
9-D 	Unassigned
E 	Global scope
F 	Reserved

MRTG

http://satsignal.eu/ntp/NTPandMRTG.html

https://store.uputronics.com/index.php?route=product/product&product_id=92

chrony can step the clock on the first 3 updates if the clock is off by more than one second. When the system doesn't have an RTC clock, this can be useful

makestep 1.0 3

When the system does have an RTC clock, chrony can sync the time

rtcsync

OpenNTP

ntpq -np
cat /var/lib/ntp/ntp.drift 
ntpdc -c kerninfo

NTP starting up (state 4) and not diciplining the clock yet (unsync)

pll offset:           -0.063174 s
pll frequency:        -2.889 ppm
maximum error:        0.076516 s
estimated error:      1.6e-05 s
status:               0040  unsync
pll time constant:    4
precision:            1e-06 s
frequency tolerance:  500 ppm

NTP operational (state 6) and the clock in a phase locked loop (pll)

pll offset:           -0.074309 s
pll frequency:        -4.266 ppm
maximum error:        0.027339 s
estimated error:      0.027506 s
status:               0001  pll
pll time constant:    6
precision:            1e-06 s
frequency tolerance:  500 ppm

root@sneezy:~# ntpq -np

    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+192.168.1.2     194.100.100.141  3 u   35   64  377    1.299  -392.16  81.343
*193.180.251.38  192.36.144.22    2 u   33   64  377  187.899  -314.91 141.803
+82.118.208.35   213.203.238.82   3 u   36   64  377  154.986  -330.89 153.852
/etc/dhcp3/dhclient.conf
/etc/ntp.conf.dhcp
/etc/ntp.conf
server 192.168.1.2
restrict -4 default kod notrap nomodify nopeer noquery
/var/lib/ntp/ntp.drift
ntpq -np
ntpdate 192.168.1.2
http://www.ntp.org/ntpfaq/NTP-s-trouble.htm

Windows Time

https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings

ms-sntp
net stop w32time
w32tm /unregister
w32tm /register
net start w32time
w32tm /resync
w32tm /config /manualpeerlist:"10.0.0.5,0x8 ntp.dnafinland.com,0xa" /syncfromflags:manual /update
w32tm /stripchart /computer:time.windows.com /dataonly /samples:5
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w32time\Parameters\NtpServer

This seems to exist, but is not actually chosen?

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers

Android

platform-tools/adb shell
settings get global ntp_server 
settings put global ntp_server 10.0.0.5 
settings put global auto_time 0 
settings put global auto_time 1 
settings get global auto_time

GPS Time

GPS as a precise sync source, there are the 31 operational GNSS, 25 Galileo and 24 Glonass Satellites

They all have a cesium or rubidium atomic clock on board and provide. Not all GPS receivers export a PPS pulse per second which can be used by the GPSD to synchronize to NTPD, the ones that do can have different accuracy based on the gps chip and the mode used. The generic NMEA in one line ASCII is less accurate than any propitiatory binary protocol.

ntpd will use a pseudo-ip address 127.127.1.34 which is a local loopback address, as network socket to the gps driver (gpsd)

In 2010 I bought an BU-353 for 65 Euro's. It contains the popular SiRF_Star_III chip, but it has no pulse per second, so I can't use it as sync source.

./configure --prefix=/usr --disable-garmin --enable-pps-on-cts --disable-evermore --disable-navcom --disable-ashtech --disable-itrax --disable-earthmate --disable-tripmate --disable-fv18 --disable-tsip --disable-ntrip --disable-rtcm104
gpsd -nN -D 5 /dev/ttyUSB0
gpsd -nN /dev/ttyUSB0

gpsctl -b
gpsctl: /dev/ttyUSB0 identified as SiRF binary GSW3.2.4_3.1.00.12-SDK003P1.00a  at 4800
gpsctl: /dev/ttyUSB0 identified as SiRF-II binary at 4800
http://wiki.openstreetmap.org/index.php/User:Dean_Earley/SiRF_Star_III
http://www.usglobalsat.com/downloads/SiRF_Binary_Protocol.pdf
http://www.mr-lee-catcam.de/BINARY/EM406a-datasheet.pdf

Mmmmh, this EM-406 looks like the stuff I saw when I disassembled the BU-353 (HA! those pins where really flimsy. That should teach me not to just pull them when drunk and trying to squeeze them back backwards =) ) ... do I have PPS on pin 6 EM-406a or a PPS-less model EM-406? and where does the PL-2303 RS232-USB converter come in to play??

http://www.usglobalsat.com/download/46/em406a_ug.pdf

Beitan BN-280

In 2019 I bough a Beitan BN-280 with a U-Blox M8N chip with a PPS pulse per second line. I used an arduino uno with SoftwareSerial on pin 10 and 11 to the gps chip. http://arduino.cc/en/Reference/SoftwareSerial

https://maker.pro/raspberry-pi/tutorial/how-to-use-a-gps-receiver-with-raspberry-pi-4

https://austinsnerdythings.com/2021/04/19/microsecond-accurate-ntp-with-a-raspberry-pi-and-pps-gps/

https://katron.org/blog/2021/10/raspberry-pi-gps/

https://www.qso.com.ar/datasheets/Receptores%20GNSS-GPS/BN-280%20GPS%20Module%20Datasheet.pdf

1 PPS Yellow
2 GND Black
3 TX White
4 RX Green
5 VCC 3 to 5V Red
6 NC Grey

https://www.u-blox.com/en/product/neo-m8-series#tab-documentation-resources

Through U-Center and the NMEA set it can be tested and configured on windows. It's also possible to switch to U-Blox binary


NTRIP, RTCM over IP

RTK

https://github.com/tomojitakasu/RTKLIB.git

https://www.maanmittauslaitos.fi/en/finpos/rtk

U-Blox ZED-F9P

GPS Commands

setSerialPort
$PSRF100,0
$PSRF100,0,38400,8,1,0*0C
*switch to binary ??
$PASHQ,RI
Debug On
$PSRF105,1*3E
Debug Off
$PSRF105,0*3F
Enable PowerSave
$PSRF150,0,300,1000,1*10
Disable Trickle
$PSRF150,0,1000,1000,0*23
Enable SBAS(WAAS/EGNOS)
$PSRF151,01*0F
Disable SBAS(WAAS/EGNOS)
$PSRF151,00*0E

Timestamp Authority

RFC 3161

ETSI EN 319 421, ETSI EN 319 422

https://blog.ascertia.com/timestamp-authority-server-the-must-have-features

Roughtime

tlsdate was a parasitic method of retrieve an approximate initial time from tls servers. Since TLS 1.3, the server hello is optional and the server may not tell the time

A new initiative is Google Roughtime, with Cloudflare documenting how to use it in a blog and with a GOLANG code, (rust and java clients exist)

https://datatracker.ietf.org/doc/draft-ietf-ntp-roughtime/07/

git clone https://github.com/cloudflare/roughtime
go get -u github.com/cloudflare/roughtime
go install github.com/cloudflare/roughtime...
getroughtime -ping roughtime.cloudflare.com:2002 -pubkey gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=
go run main.go -ping roughtime.cloudflare.com:2002 -pubkey gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=
dig TXT roughtime.cloudflare.com | grep -oP 'TXT\s"\K.*?(?=")'
go run main.go -ping roughtime.cloudflare.com:2002 -pubkey gD63hSj3ScS+wuOeGrubXlq35N1c5Lby/S+T7MNTjxo=
go run main.go -ping roughtime.dnov.se:2002 -pubkey hlKAFAeU+xDZ1+9eVgrXel+m3sRiSlzoqCsqL9WoRB0=
go run main.go -ping roughtime.int08h.com:2002 -pubkey AW5uAoTSTDfG5NfY1bTh08GUnOqlRb+HVhbJ3ODJvsE=
go run main.go -ping roughtime.se:2002 -pubkey S3AzfZJ5CjSdkJ21ZJGbxqdYP/SoE8fXKY0+aicsehI=
go run main.go -ping time.0xt.ca:2002 -pubkey iBVjxg/1j7y1+kQUTBYdTabxCppesU/07D4PMDJk2WA=
go run main.go -ping roughtime.chainpoint.org:2002 -pubkey bbT+RPS7zKX6w71ssPibzmwWqU9ffRV5oj2OresSmhE=
go run main.go -ping roughtime.sandbox.google.com:2002 -pubkey etPaaIxcBMY1oUeGpwvPMCJMwlRVNxv51KK/tktoJTQ=
go run main.go -ping ticktock.mixmin.net:5333 -pubkey cj8GsiNlRkqiDElAeNMSBBMwrAl15hYPgX50+GWX/lA=

None of these server respond or use the correct version

PHP

It's probably easier to implement a time reporting function and tie it to a valid TLS certificate

https://janmg.com/time.php

<?php
  header('Content-Type:text/plain');
  header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
  header("Cache-Control: post-check=0, pre-check=0", false);
  header("Pragma: no-cache");
  echo gmdate("Y-m-d  H:i:s");
?>