-
Notifications
You must be signed in to change notification settings - Fork 1
Home
NtpSync is a utility which implements an NTP client, based on Cristian's synchronization algorithm.
The package provides a C library and the relative Python wrapper plus an example of usage for python2.7 (NtpSyncTest.py). The NTP client runs in a thread.
Supported platforms: OS X, Linux
A brief description of the C API:
Start the synchronization thread
- ip_address: IP address of the NTP server
- max_offset_ms: maximum tolerated offset between clocks, in millisecs
- inter_sync_delay_ms: period between syncronizations, in millisecs
Stop the synchronization thread
Set the time zero value of the internal reference clock
- ms: time value to set, in milliseconds
Get a timestamp from the internal reference clock
Get the time zero value of the internal reference clock
Get the last error occurred
Possible values:
- 0 = eNtpSyncError_no // all is fine
- 1 = eNtpSyncError_send // connection issue
- 2 = eNtpSyncError_receive // connection issue
- 3 = eNtpSyncError_version // packet version issue
- 4 = eNtpSyncError_kod // received a kiss of death packet
- 5 = eNtpSyncError_unexpected // unexpected timestamp value
- 6 = eNtpSyncError_accuracy_broken // failed to synchronize
Set a callback which will be executed whenever an error occurs
- cb: callback function
- prm: callback parameter
Utility function which provides a monotonic timestamp in milliseconds (unrelated to the internal reference clock)