From e510f1b4801a94a370255a9c76bd6a3f6384e137 Mon Sep 17 00:00:00 2001 From: Rop Date: Fri, 21 Dec 2018 16:34:01 +1100 Subject: [PATCH] Fix issue #20 causing timeouts in examples --- README.md | 2 ++ examples/EthernetShield/EthernetShield.ino | 9 ++++++++- examples/Timezones/Timezones.ino | 9 ++++++++- library.json | 2 +- library.properties | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c8e1d8c..6b653f3 100644 --- a/README.md +++ b/README.md @@ -376,6 +376,8 @@ If you provide no location ( `YourTZ.setLocation()` ), ezTime will attempt to do In the case of `SERVER_ERROR`, `errorString()` returns the error from the server, which might be "Country Spans Multiple Timezones", "Country Not Found", "GeoIP Lookup Failed" or "Timezone Not Found". +If you execute multiple calls to `setLocation`, make sure they are more than 3 seconds apart, because the server will not answer if calls from the same IP come within 3 seconds of one another (see below). +   ### timezoned.rop.nl diff --git a/examples/EthernetShield/EthernetShield.ino b/examples/EthernetShield/EthernetShield.ino index d7ce1f4..1fb0f4e 100644 --- a/examples/EthernetShield/EthernetShield.ino +++ b/examples/EthernetShield/EthernetShield.ino @@ -57,10 +57,17 @@ void setup() { Serial.print(F("New Zealand: ")); Serial.println(myTZ.dateTime()); + // Wait a little bit to not trigger DDoS protection on server + // See https://github.com/ropg/ezTime#timezonedropnl + delay(5000); + // Or country codes for countries that do not span multiple timezones myTZ.setLocation(F("de")); Serial.print(F("Germany: ")); - Serial.println(myTZ.dateTime()); + Serial.println(myTZ.dateTime()); + + // Same as above + delay(5000); // See if local time can be obtained (does not work in countries that span multiple timezones) Serial.print(F("Local (GeoIP): ")); diff --git a/examples/Timezones/Timezones.ino b/examples/Timezones/Timezones.ino index 174c0b1..997cf42 100644 --- a/examples/Timezones/Timezones.ino +++ b/examples/Timezones/Timezones.ino @@ -23,10 +23,17 @@ void setup() { Serial.print(F("New Zealand: ")); Serial.println(myTZ.dateTime()); + // Wait a little bit to not trigger DDoS protection on server + // See https://github.com/ropg/ezTime#timezonedropnl + delay(5000); + // Or country codes for countries that do not span multiple timezones myTZ.setLocation(F("de")); Serial.print(F("Germany: ")); - Serial.println(myTZ.dateTime()); + Serial.println(myTZ.dateTime()); + + // Same as above + delay(5000); // See if local time can be obtained (does not work in countries that span multiple timezones) Serial.print(F("Local (GeoIP): ")); diff --git a/library.json b/library.json index c498db8..60d4a80 100644 --- a/library.json +++ b/library.json @@ -11,7 +11,7 @@ "type": "git", "url": "https://github.com/ropg/ezTime" }, - "version": "0.7.8", + "version": "0.7.9", "framework": "arduino", "platforms": "*", "build": { diff --git a/library.properties b/library.properties index a7d39e1..397d32e 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ezTime -version=0.7.8 +version=0.7.9 author=Rop Gonggrijp maintainer=Rop Gonggrijp sentence=ezTime - pronounced "Easy Time" - is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.