Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
sntp_client.c File Reference
SNTP client (Simple Network Time Protocol) More...
Go to the source code of this file.
| Functions | |
| error_t | sntpClientGetTimestamp (NetInterface *interface, const IpAddr *serverIpAddr, NtpTimestamp *timestamp) | 
| Retrieve current time from NTP server using SNTP protocol. | |
| error_t | sntpSendRequest (SntpClientContext *context) | 
| Send NTP request using SNTP protocol. | |
| error_t | sntpWaitForResponse (SntpClientContext *context, systime_t timeout) | 
| Wait for a valid response from the NTP server. | |
| error_t | sntpParseResponse (SntpClientContext *context, const NtpHeader *message, size_t length) | 
| Parse NTP server response. | |
| void | sntpDumpMessage (const NtpHeader *message, size_t length) | 
| Dump NTP message for debugging purpose. | |
| void | sntpDumpTimestamp (const NtpTimestamp *timestamp) | 
| Dump NTP timestamp. | |
Detailed Description
SNTP client (Simple Network Time Protocol)
License
Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Description
The Simple Network Time Protocol is used to synchronize computer clocks in the Internet. Refer to RFC 4330 for more details
- Version:
- 1.7.6
Definition in file sntp_client.c.
Function Documentation
| error_t sntpClientGetTimestamp | ( | NetInterface * | interface, | 
| const IpAddr * | serverIpAddr, | ||
| NtpTimestamp * | timestamp | ||
| ) | 
Retrieve current time from NTP server using SNTP protocol.
- Parameters:
- 
  [in] interface Underlying network interface (optional parameter) [in] serverIpAddr IP address of the NTP server [out] timestamp Current time 
- Returns:
- Error code
Definition at line 55 of file sntp_client.c.
| void sntpDumpMessage | ( | const NtpHeader * | message, | 
| size_t | length | ||
| ) | 
Dump NTP message for debugging purpose.
- Parameters:
- 
  [in] message Pointer to the NTP message [in] length Length of the NTP message 
Definition at line 280 of file sntp_client.c.
| void sntpDumpTimestamp | ( | const NtpTimestamp * | timestamp ) | 
Dump NTP timestamp.
- Parameters:
- 
  [in] timestamp Pointer to the NTP timestamp 
Definition at line 345 of file sntp_client.c.
| error_t sntpParseResponse | ( | SntpClientContext * | context, | 
| const NtpHeader * | message, | ||
| size_t | length | ||
| ) | 
Parse NTP server response.
- Parameters:
- 
  [in] context Pointer to the SNTP client context [in] message NTP response message to parse [in] length Length of the incoming NTP message 
- Returns:
- Error code
Definition at line 238 of file sntp_client.c.
| error_t sntpSendRequest | ( | SntpClientContext * | context ) | 
Send NTP request using SNTP protocol.
- Parameters:
- 
  [in] context SNTP client context 
- Returns:
- Error code
Definition at line 142 of file sntp_client.c.
| error_t sntpWaitForResponse | ( | SntpClientContext * | context, | 
| systime_t | timeout | ||
| ) | 
Wait for a valid response from the NTP server.
- Parameters:
- 
  [in] context Pointer to the SNTP client context [in] timeout Maximum time period to wait 
- Returns:
- Error code
Definition at line 186 of file sntp_client.c.
Generated on Tue Jul 12 2022 17:10:22 by
 1.7.2
 1.7.2