Skip to content

Commit 6317a2a

Browse files
committed
Tweaked update times
1 parent aeac2a9 commit 6317a2a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/Buienalarm.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ module.exports = class Buienalarm {
1818

1919
// Data is only updated once every 4 minutes, doesn't make sense to retrieve it before it changes, so we take 245 seconds (4 minutes and 5 seconds)
2020
if (this.forecasts.updated != null) {
21-
var rounded = new Date(Math.ceil(this.forecasts.updated.getTime() / 245000) * 245000);
22-
getNewForecast = (now >= rounded);
21+
getNewForecast = (((now.getTime() - this.forecasts.updated.getTime()) / 1000) >= 245);
2322
}
2423

2524
if (this.forecasts.parsed == null) {

lib/Buienradar.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ module.exports = class Buienradar {
1818

1919
// Data is only updated once every 5 minutes, doesn't make sense to retrieve it before it changes.
2020
if (this.forecasts.fetched != null) {
21-
var rounded = new Date(Math.ceil(this.forecasts.fetched.getTime() / 300000) * 300000);
22-
getNewForecast = (now >= rounded);
21+
getNewForecast = (((now.getTime() - this.forecasts.fetched.getTime()) / 1000) >= 300);
2322
}
2423

2524
if (this.forecasts.parsed == null) {

0 commit comments

Comments
 (0)