Skip to content

Commit a4787dc

Browse files
author
Ervin Hegedüs
committed
Added the correct timezone to parsing of dates
1 parent af56f06 commit a4787dc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

waflog/read.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ func (ll *FTWLogLines) getLinesSinceUntil() [][]byte {
7979
ChunkSize: 4096,
8080
}
8181
scanner := backscanner.NewOptions(logfile, int(fi.Size()), backscannerOptions)
82+
tzonename, _ := time.Now().Zone()
83+
tzone := gostradamus.Timezone(tzonename)
8284
for {
8385
line, _, err := scanner.LineBytes()
8486
if err != nil {
@@ -93,7 +95,7 @@ func (ll *FTWLogLines) getLinesSinceUntil() [][]byte {
9395
date := matchedLine[1]
9496
log.Trace().Msgf("ftw/waflog: matched %s in line %s", date, matchedLine)
9597
// well, go doesn't want to have a proper time format, so we need to use gostradamus
96-
t, err := gostradamus.Parse(string(date), ll.TimeFormat)
98+
t, err := gostradamus.ParseInTimezone(string(date), ll.TimeFormat, tzone)
9799
if err != nil {
98100
log.Error().Msgf("ftw/waflog: error parsing date %s", err.Error())
99101
// return with what we got up to now

0 commit comments

Comments
 (0)