-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ability to manually sync with NTP
- Loading branch information
Showing
3 changed files
with
32 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,38 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Meadow | ||
namespace Meadow; | ||
|
||
/// <summary> | ||
/// Delegate representing a time changed event handler. | ||
/// </summary> | ||
/// <param name="utcTime">The updated UTC time.</param> | ||
public delegate void TimeChangedEventHandler(DateTime utcTime); | ||
|
||
/// <summary> | ||
/// Interface for a Network Time Protocol (NTP) client object. | ||
/// </summary> | ||
public interface INtpClient | ||
{ | ||
/// <summary> | ||
/// Delegate representing a time changed event handler. | ||
/// Event called when the time is changed. | ||
/// </summary> | ||
/// <param name="utcTime">The updated UTC time.</param> | ||
public delegate void TimeChangedEventHandler(DateTime utcTime); | ||
event TimeChangedEventHandler TimeChanged; | ||
|
||
/// <summary> | ||
/// Interface for a Network Time Protocol (NTP) client object. | ||
/// Gets a value indicating whether the NTP client is enabled. | ||
/// </summary> | ||
public interface INtpClient | ||
{ | ||
/// <summary> | ||
/// Event called when the time is changed. | ||
/// </summary> | ||
event TimeChangedEventHandler TimeChanged; | ||
bool Enabled { get; } | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether the NTP client is enabled. | ||
/// </summary> | ||
bool Enabled { get; } | ||
/// <summary> | ||
/// Gets or sets the poll period for NTP synchronization. | ||
/// </summary> | ||
TimeSpan PollPeriod { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the poll period for NTP synchronization. | ||
/// </summary> | ||
TimeSpan PollPeriod { get; set; } | ||
} | ||
/// <summary> | ||
/// Start an NTP time synchronization | ||
/// </summary> | ||
/// <param name="ntpServer">An optional NTP server address. If null, the device will use the platform-configured NTP server address</param> | ||
/// <returns><b>true</b> if successful, otherwise <b>false</b></returns> | ||
Task<bool> Synchronize(string? ntpServer = null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters