NTP(Network Time Protocol) Client Library.

Fork of NTPClientLib by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

NTPClient Class Reference

NTPClient Class Reference

NTP Client to update the mbed's RTC using a remote time server. More...

#include <NTPClient.h>

Public Member Functions

 NTPClient ()
 Instantiate the NTP client.
int setTime (const char *host, uint16_t port=NTP_DEFAULT_PORT, uint32_t timeout=NTP_DEFAULT_TIMEOUT)
 Get current time (blocking) Update the time using the server host Blocks until completion.

Detailed Description

NTP Client to update the mbed's RTC using a remote time server.

Definition at line 37 of file NTPClient.h.


Constructor & Destructor Documentation

NTPClient (  )

Instantiate the NTP client.

Definition at line 40 of file NTPClient.cpp.


Member Function Documentation

int setTime ( const char *  host,
uint16_t  port = NTP_DEFAULT_PORT,
uint32_t  timeout = NTP_DEFAULT_TIMEOUT 
)

Get current time (blocking) Update the time using the server host Blocks until completion.

Parameters:
hostNTP server IPv4 address or hostname (will be resolved via DNS)
portport to use; defaults to 123
timeoutwaiting timeout in ms (osWaitForever for blocking function, not recommended)
Returns:
0 on success, NET error code (<0) on failure

Definition at line 46 of file NTPClient.cpp.