-
Notifications
You must be signed in to change notification settings - Fork 9
/
TimeClient.h
43 lines (35 loc) · 915 Bytes
/
TimeClient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef __TIMECLIENT_H__
#define __TIMECLIENT_H__
/*
WTA Client
Get the time from the worldtimeapi-server to prevent timezone and DST-mess
Demonstrates use http-client and json-parser
created 4 Sep 2010
by Michael Margolis
modified 9 Apr 2012
by Tom Igoe
updated for the ESP8266 12 Apr 2015
by Ivan Grokhotkov
Refactored into NTPClient class by Hari Wiguna, 2018
changed from NTP to worldtimeapi by SnowHead, 2019
This code is in the public domain.
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
extern unsigned long askFrequency;
class TimeClient {
public:
TimeClient();
void Setup(void);
unsigned long GetCurrentTime();
byte GetHours();
byte GetMinutes();
byte GetSeconds();
void PrintTime();
bool SaveConfig(void);
bool LoadConfig(void);
private:
void AskCurrentEpoch();
unsigned long ReadCurrentEpoch();
};
#endif // __TIMECLIENT_H__