Update commons-suncalc to 3.5

This commit is contained in:
MM20 2022-01-31 13:29:54 +01:00
parent 162cd0b262
commit 134d09c3ae
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 6 additions and 6 deletions

View File

@ -300,7 +300,7 @@ dependencyResolutionManagement {
alias("suncalc")
.to("org.shredzone.commons", "commons-suncalc")
.version("2.12")
.version("3.5")
alias("jsoup")
.to("org.jsoup", "jsoup")

View File

@ -32,20 +32,20 @@ class MetNoProvider(override val context: Context) : LatLonWeatherProvider() {
val rise = sunTimes.rise
if (set == null && rise != null) {
return timestamp < rise.time
return timestamp < rise.toEpochSecond() * 1000
}
if (set != null && rise == null) {
return set.time < timestamp
return set.toEpochSecond() * 1000 < timestamp
}
if (set == null || rise == null) return false
if (set.time < rise.time) {
return (set.time < timestamp && timestamp < rise.time)
if (set.toEpochSecond() < rise.toEpochSecond()) {
return (set.toEpochSecond() * 1000 < timestamp && timestamp < rise.toEpochSecond() * 1000)
}
return !(rise.time < timestamp && timestamp < set.time)
return !(rise.toEpochSecond() * 1000 < timestamp && timestamp < set.toEpochSecond() * 1000)
}