Class NtpClientBase
base Client for Network Time Protocol
Assembly: Meadow.dll
View Source
Declaration
public abstract class NtpClientBase : INtpClient
Implements:
Meadow.INtpClient
Properties
Enabled
Gets a value indicating whether the NTP client is enabled.
View Source
Declaration
public abstract bool Enabled { get; }
PollPeriod
Gets or sets the poll period for NTP synchronization.
View Source
Declaration
public abstract TimeSpan PollPeriod { get; set; }
Methods
RaiseTimeChanged(DateTime)
Raises the TimeChanged event with a given time
View Source
Declaration
protected void RaiseTimeChanged(DateTime utcTime)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | utcTime | The new time |
Synchronize(string?)
Start an NTP time synchronization
View Source
Declaration
public Task<bool> Synchronize(string? ntpServer = null)
Returns
System.Threading.Tasks.Task<System.Boolean>
: <b>true</b> if successful, otherwise <b>false</b>
Parameters
Type | Name | Description |
---|---|---|
System.String | ntpServer | An optional NTP server address. If null, the device will use the platform-configured NTP server address |
Events
TimeChanged
Event called when the time is changed.
View Source
Declaration
public event TimeChangedEventHandler TimeChanged
Event Type
Meadow.TimeChangedEventHandler