Skip to content

Commit

Permalink
Ensure timestamps are saved as and rendered as UTC timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahFrench committed Jan 9, 2025
1 parent c4f291a commit b5cc74e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/backend/local/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ func (runner *TestFileRunner) Test(file *moduletest.File) {
}
}

startTime := time.Now()
startTime := time.Now().UTC()
state, updatedState := runner.run(run, file, runner.RelevantStates[key].State, config)
runDuration := time.Since(startTime)
if updatedState {
Expand Down
5 changes: 3 additions & 2 deletions internal/moduletest/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ type RunExecutionMeta struct {
Duration time.Duration
}

// StartTimestamp returns the start time metadata as a timestamp formatted as YYYY-MM-DDTHH:MM:SS.
// StartTimestamp returns the start time metadata as a timestamp formatted as YYYY-MM-DDTHH:MM:SSZ.
// Times are converted to UTC, if they aren't already.
// If the start time is unset an empty string is returned.
func (m *RunExecutionMeta) StartTimestamp() string {
if m.Start.IsZero() {
return ""
}
return m.Start.Format(time.RFC3339)
return m.Start.UTC().Format(time.RFC3339)
}

// Verbose is a utility struct that holds all the information required for a run
Expand Down

0 comments on commit b5cc74e

Please sign in to comment.