Comments (1)
Example Sketch:
#include <ezTime.h>
#include <WiFi.h>
unsigned long previousMillis = 0;
Timezone myTZ;
void setup() {
Serial.begin(115200);
WiFi.begin("xxxxx", "xxxxx");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
setDebug(DEBUG);
waitForSync();
myTZ.setLocation(F("gb"));
myTZ.setDefault();
}
void loop() {
unsigned long currentMillis = millis();
events();
if (currentMillis - previousMillis >= 1000) {
previousMillis = currentMillis;
Serial.println("Time: " + myTZ.dateTime());
}
}
ezTime debug level set to DEBUG
Waiting for time sync
Querying pool.ntp.org ... success (round trip 17 ms)
Received time: Sunday, 06-Jan-19 19:08:57.553 UTC
Set event (#1) to trigger on: Sunday, 06-Jan-2019 19:18:57 UTC
Time is in sync
Timezone lookup for: gb ... (round-trip 54 ms) success.
Olsen: Europe/London
Posix: GMT0BST,M3.5.0/1,M10.5.0
Default timezone set to Europe/London GMT0BST,M3.5.0/1,M10.5.0
Time: Sunday, 06-Jan-2019 19:08:57 GMT
Time: Sunday, 06-Jan-2019 19:08:58 GMT
Time: Sunday, 06-Jan-2019 19:08:59 GMT
.....
Time: Sunday, 06-Jan-2019 20:18:53 GMT
Time: Sunday, 06-Jan-2019 20:18:54 GMT
Time: Sunday, 06-Jan-2019 20:18:55 GMT
Running event (#1) set for Sunday, 06-Jan-2019 20:18:56 UTC
Querying pool.ntp.org ... success (round trip 55 ms)
Received time: Sunday, 06-Jan-19 20:18:55.985 UTC (internal clock was 71 ms slow)
Set event (#1) to trigger on: Sunday, 06-Jan-2019 20:28:55 UTC
Time: Sunday, 06-Jan-2019 20:18:56 GMT
Time: Sunday, 06-Jan-2019 20:18:57 GMT
Time: Sunday, 06-Jan-2019 20:18:58 GMT
All good until the clock suddenly jumps from 20:19:00 to a future time, seems to then trigger an NTP update (And all events):
Time: Sunday, 06-Jan-2019 20:18:59 GMT
Time: Sunday, 06-Jan-2019 20:19:00 GMT
Running event (#1) set for Sunday, 06-Jan-2019 20:28:55 UTC
Querying pool.ntp.org ... success (round trip 19 ms)
Received time: Sunday, 06-Jan-19 20:19:01.366 UTC (internal clock was 4294951 ms fast)
Set event (#1) to trigger on: Sunday, 06-Jan-2019 20:29:01 UTC
Time: Sunday, 06-Jan-2019 20:19:01 GMT
Time: Sunday, 06-Jan-2019 20:19:02 GMT
Time: Sunday, 06-Jan-2019 20:19:03 GMT
from eztime.
Related Issues (20)
- hour() is off when passing in a timestamp, or I'm using it wrong? HOT 2
- can't set time zone for Asia/Tehran
- Improving library features
- Asia/Jerusalem returns empty posix string HOT 1
- readme update for "different languages"
- examples Timezones.ino proposed enhancement - thanks
- Dublin timezone incorrect time HOT 1
- 'myTZ was not declared in this scope'
- Feature request
- day(t) seems to return incorrect value
- Using ezTime with nodemcu-32s w/64x32 HUb75 LED Matrix HOT 5
- Stack problem whtn activate the waitForSync
- ezTime for ESP32 Wired Ethernet on Olimex ESP32-POE-ISO Working
- Won't sync with NTP if module can't access internet HOT 1
- It doesn't work with Lan8720 ethernet.
- Library without interruptions suggestion HOT 2
- Use ip-api.com to fetch timezone offsets more accurately? HOT 3
- Timezone data is not correct for Europe/Dublin
- Global Scope Enumerations Prevent Compilation
- Timezone lookup for: <TZ> ... ERROR: Timeout
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eztime.