changeset 5201:40daecc6f552 new-fwa

Made timeranges all UTC.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 08 May 2020 15:34:28 +0200
parents 5572da077c89
children fbc79c8459b4
files pkg/controllers/fwa.go
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/fwa.go	Fri May 08 15:29:36 2020 +0200
+++ b/pkg/controllers/fwa.go	Fri May 08 15:34:28 2020 +0200
@@ -187,6 +187,11 @@
 	return !(to.Before(tr.lower) || from.After(tr.upper))
 }
 
+func (tr *timeRange) toUTC() {
+	tr.lower = tr.lower.UTC()
+	tr.upper = tr.upper.UTC()
+}
+
 func (lvs limitingValidities) find() func(from, to time.Time) *limitingValidity {
 
 	var last *limitingValidity
@@ -233,8 +238,7 @@
 		); err != nil {
 			return nil, err
 		}
-		lv.lower = lv.lower.UTC()
-		lv.upper = lv.upper.UTC()
+		lv.toUTC()
 		lvs = append(lvs, lv)
 	}
 
@@ -340,6 +344,7 @@
 		if err := rows.Scan(&l.lower, &l.upper, &l.value); err != nil {
 			return err
 		}
+		l.toUTC()
 		for i := range bn.validities {
 			vs := bn.validities[i]
 			if vs.intersects(l.lower, l.upper) {