Skip to content

Commit b3207c7

Browse files
committed
Use more robust version of the configTime function
1 parent 8d03d25 commit b3207c7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

examples/WeatherStationDemo/WeatherStationDemo.ino

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ See more at https://thingpulse.com
5555
const char* WIFI_SSID = "yourssid";
5656
const char* WIFI_PWD = "yourpassw0rd";
5757

58-
#define TZ 2 // (utc+) TZ in hours
59-
#define DST_MN 60 // use 60mn for summer time in some countries
58+
// Timezone
59+
// Enter a POSIX timezone string. A current list can be found here:
60+
// https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv
61+
#define TZ "CET-1CEST,M3.5.0,M10.5.0/3"
6062

6163
// Setup
6264
const int UPDATE_INTERVAL_SECS = 20 * 60; // Update every 20 minutes
@@ -116,9 +118,6 @@ OpenWeatherMapCurrent currentWeatherClient;
116118
OpenWeatherMapForecastData forecasts[MAX_FORECASTS];
117119
OpenWeatherMapForecast forecastClient;
118120

119-
#define TZ_MN ((TZ)*60)
120-
#define TZ_SEC ((TZ)*3600)
121-
#define DST_SEC ((DST_MN)*60)
122121
time_t now;
123122

124123
// flag changed in the ticker function every 10 minutes
@@ -179,7 +178,7 @@ void setup() {
179178
counter++;
180179
}
181180
// Get time from network time service
182-
configTime(TZ_SEC, DST_SEC, "pool.ntp.org");
181+
configTzTime(TZ, "pool.ntp.org");
183182

184183
ui.setTargetFPS(30);
185184

0 commit comments

Comments
 (0)