Skip to content

Commit

Permalink
Fix issue #20 causing timeouts in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ropg committed Dec 21, 2018
1 parent 02b30ed commit e510f1b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion examples/EthernetShield/EthernetShield.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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): "));
Expand Down
9 changes: 8 additions & 1 deletion examples/Timezones/Timezones.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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): "));
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "git",
"url": "https://github.com/ropg/ezTime"
},
"version": "0.7.8",
"version": "0.7.9",
"framework": "arduino",
"platforms": "*",
"build": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

1 comment on commit e510f1b

@justin-romano
Copy link

@justin-romano justin-romano commented on e510f1b Oct 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. i dont want to be a too an accidental code reviewer but.... dont you think you should fix your server rather than force all to put huge delays into their code to work around your dos attack code?
Should there be only one call to the timezone server anyway when you set the location?
oh and useful library btw ;)

Please sign in to comment.