Discover Packages
github.com/lemon-mint/timeserver
command
module
Version:
v1.2.6
Opens a new window with list of versions in this module.
Published: Feb 23, 2023
License: MIT
Opens a new window with license information.
Imports: 12
Opens a new window with list of imports.
Imported by: ? modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
README
README
¶
Time Server
HTTP Time Server that returns the current server time
How it works
Terminology
t0: time when the client sends the request
t1: time when the server receives the request
t2: time when the server sends the response
t3: time when the client receives the response
Protocol
The Client sends a request GET /tt to the server.
The server is written in Go and returns the current time in the following format:
18446744073709551615$18446744073709551615
The Client can parse the response by splitting the string by $ and converting the first part to t1 and the second part to t2.
The Client can calculate offset by the following formula:
offset = (t1 - t0 + t2 - t3) / 2;
The Client also can calculate sync error by the following formula:
error = Math.abs(t3 - t0 - (t2 - t1)) / 2;
The Client repeats the request several times and calculates and records the offset and error for each request.
After that client calculates the confidence interval using the Intersection algorithm .
Expand ▾
Collapse ▴
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.