Skip to content

Commit

Permalink
Merge pull request #295 from czcorpus/set_time_fix
Browse files Browse the repository at this point in the history
Fix - mismatch between string-encoded and regular time in out. rec.
  • Loading branch information
tomachalek authored Dec 10, 2024
2 parents 877b914 + 065918f commit bd68902
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions servicelog/kontext015/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ type OutputRecord struct {
// SetTime is defined for other treq variants
// so they can all share the same output rec. type
func (cnkr *OutputRecord) SetTime(t time.Time, tzShiftMin int) {
cnkr.Datetime = t.Add(time.Minute * time.Duration(tzShiftMin)).Format(time.RFC3339)
cnkr.time = t
t2 := t.Add(time.Minute * time.Duration(tzShiftMin))
cnkr.Datetime = t2.Format(time.RFC3339)
cnkr.time = t2
}

// ToJSON converts self to JSON string
Expand Down
5 changes: 3 additions & 2 deletions servicelog/treq/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ type OutputRecord struct {
// SetTime is defined for other treq variants
// so they can all share the same output rec. type
func (r *OutputRecord) SetTime(t time.Time, tzShiftMin int) {
r.Datetime = t.Add(time.Minute * time.Duration(tzShiftMin)).Format(time.RFC3339)
r.time = t
t2 := t.Add(time.Minute * time.Duration(tzShiftMin))
r.Datetime = t2.Format(time.RFC3339)
r.time = t2
}

// SetLocation sets all the location related properties
Expand Down

0 comments on commit bd68902

Please sign in to comment.