ntp_time
frog.hardware.plugins.time.ntp_time
¤
This module provides an interface for querying time from an NTP server.
Attributes¤
Classes¤
NTPTime(ntp_host=TIME_NTP_HOST, ntp_version=TIME_NTP_VERSION, ntp_port=TIME_NTP_PORT, ntp_timeout=TIME_NTP_TIMEOUT, ntp_poll_interval=TIME_NTP_POLL_INTERVAL)
¤
Bases: TimeBase
A time source that queries an NTP server.
Create a new NTPTime.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ntp_host
|
str
|
The IP address or hostname of the NTP server |
TIME_NTP_HOST
|
ntp_version
|
int
|
The NTP version to use |
TIME_NTP_VERSION
|
ntp_port
|
int
|
The port to connect to |
TIME_NTP_PORT
|
ntp_timeout
|
float
|
The maximum time to wait for a response |
TIME_NTP_TIMEOUT
|
ntp_poll_interval
|
float
|
How often to query the NTP server (seconds) |
TIME_NTP_POLL_INTERVAL
|
Source code in frog/hardware/plugins/time/ntp_time.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
Functions¤
close()
¤
Close the device.
Source code in frog/hardware/plugins/time/ntp_time.py
87 88 89 90 |
|
get_time_offset()
¤
Get the current time offset in seconds.
Returns:
Type | Description |
---|---|
float
|
A float representing the current time offset. |
Source code in frog/hardware/plugins/time/ntp_time.py
79 80 81 82 83 84 85 |
|
poll_time_offset()
¤
Query the NTP server for the current time offset.
Source code in frog/hardware/plugins/time/ntp_time.py
65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
NTPTimeError
¤
Bases: Exception
Indicates that an error occurred while querying the NTP time server.