EtherSia
A minimal IPv6 Ethernet library for Arduino.
Functions | Variables
SNTPClient.ino File Reference

SNTP Client - sends UDP requests to an IPv6 NTP Server and displays the current time. More...

#include <EtherSia.h>
#include "ntp.h"

Functions

void displayTime (unsigned long secs)
 Decode a NTP timestamp and print it to Serial. More...
 

Variables

EtherSia_W5100 ether (10)
 Wiznet W5100 ethernet interface (with Chip Select connected to Pin 10)
 
UDPSocket udp (ether)
 Define a UDP socket to send packets from.
 
const uint32_t DEFAULT_POLLING_INTERVAL = 15
 How often to send NTP packets - RFC4330 says this shouldn't be less than 15 seconds.
 
boolean needNewServer = true
 Set to true when a DNS lookup needs to be performed.
 
unsigned long nextRequest = millis()
 The time that the next NTP request should be sent.
 
unsigned long pollingInterval = DEFAULT_POLLING_INTERVAL
 How often (in seconds) that NTP requests should be sent.
 

Detailed Description

SNTP Client - sends UDP requests to an IPv6 NTP Server and displays the current time.

SNTP is a simple subnet of the full NTP protocol.

See RFC4330 for details of the protocol:

This example demonstrates of the basics of an SNTP client; A real-world client should enforce RFC4330 properly, such as the randomised time before sending a query at startup.

This example uses a static MAC address, please update with your own.

Get your own Random Locally Administered MAC Address here: https://www.hellion.org.uk/cgi-bin/randmac.pl

Function Documentation

◆ displayTime()

void displayTime ( unsigned long  secs)

Decode a NTP timestamp and print it to Serial.

Parameters
secsThe number of seconds since the year 1900
Examples:
SNTPClient.ino.