Skip to content
Library to read time from Network Time Protocol (NTP) servers.
Branch: master
Clone or download
Latest commit 292e7df Aug 10, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Fix travis #1 Aug 9, 2017
src Initial commit Jun 29, 2017
.travis.yml Fix travis #6 Aug 10, 2017
LICENSE Initial commit Jun 29, 2017
README.md Example description Aug 9, 2017
keywords.txt Initial commit Jun 29, 2017
library.json Added Arduino UNO ESP-01 example and test Aug 9, 2017
library.properties Added Arduino UNO ESP-01 example and test Aug 9, 2017

README.md

EasyNTPClient

Collaborizm Build Status

Arduino library to read time from Network Time Protocol (NTP) servers.

 

Features

  • Handles all heavy lifting involved with managing connections to and parsing time from an NTP server.
  • As easy as providing a UDP object to the constructor during initialization.
  • Works on Arduino and ESP8266.

 

Examples

  1. NodeMCU
    Using EasyNTPClient on a NodeMCU (ESP8266)

  2. ArduinoEspWifiShield
    Using EasyNTPClient on an Arduino UNO with an ESP-01 (ESP8266) WiFi module.
    By Claran Martis

 

Reference

Class EasyNTPClient

1. Initialization

  1. No frills
EasyNTPClient(UDP &udp)

Parameters:
    udp: Reference to an UDP object.
Returns:
    EasyNTPClient object.
  1. Custom server pool
EasyNTPClient(UDP& udp, const char* serverPool)

Parameters:
    udp: Reference to an UDP object.
	serverPool: NTP server pool. Default = "pool.ntp.org"
Returns:
    EasyNTPClient object.
  1. Time offset
EasyNTPClient(UDP& udp, const char* serverPool, int offset);

Parameters:
    udp: Reference to an UDP object.
	serverPool: NTP server pool domain name. Default = "pool.ntp.org"
	offset: Difference from UTC in seconds. Default = 0
Returns:
    EasyNTPClient object.

2. Methods

  1. Get time offset
int getTimeOffset()

Returns:
    EasyNTPClient object.
  1. Set time offset
void setTimeOffset(int offset);

Parameters:
    offset: Difference from UTC in seconds.
  1. Get time in UNIX format
unsigned long getUnixTime();

Returns:
    UTC time in UNIX time format (seconds)
You can’t perform that action at this time.