Skip to content

Commit

Permalink
Merge pull request #551 from lightninglabs/use-utc-consistently
Browse files Browse the repository at this point in the history
Fix instances of `time.Now()` which should be set to UTC
  • Loading branch information
ffranr authored Oct 6, 2023
2 parents afece9e + e87d905 commit aa8d776
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tapdb/universe_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (u *UniverseStats) LogSyncEvent(ctx context.Context,
}

return db.InsertNewSyncEvent(ctx, NewSyncEvent{
EventTime: u.clock.Now(),
EventTime: u.clock.Now().UTC(),
EventTimestamp: u.clock.Now().UTC().Unix(),
AssetID: uniID.AssetID[:],
GroupKeyXOnly: groupKeyXOnly,
Expand All @@ -162,7 +162,7 @@ func (u *UniverseStats) LogSyncEvents(ctx context.Context,
}

err := db.InsertNewSyncEvent(ctx, NewSyncEvent{
EventTime: u.clock.Now(),
EventTime: u.clock.Now().UTC(),
EventTimestamp: u.clock.Now().UTC().Unix(),
AssetID: uniID.AssetID[:],
GroupKeyXOnly: groupKeyXOnly,
Expand All @@ -188,7 +188,7 @@ func (u *UniverseStats) LogNewProofEvent(ctx context.Context,
}

return db.InsertNewProofEvent(ctx, NewProofEvent{
EventTime: u.clock.Now(),
EventTime: u.clock.Now().UTC(),
EventTimestamp: u.clock.Now().UTC().Unix(),
AssetID: uniID.AssetID[:],
GroupKeyXOnly: groupKeyXOnly,
Expand All @@ -212,7 +212,7 @@ func (u *UniverseStats) LogNewProofEvents(ctx context.Context,
}

err := db.InsertNewProofEvent(ctx, NewProofEvent{
EventTime: u.clock.Now(),
EventTime: u.clock.Now().UTC(),
EventTimestamp: u.clock.Now().UTC().Unix(),
AssetID: uniID.AssetID[:],
GroupKeyXOnly: groupKeyXOnly,
Expand Down
2 changes: 1 addition & 1 deletion tapdb/universe_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestUniverseStatsEvents(t *testing.T) {

db := NewTestDB(t)

yesterday := time.Now().Add(-24 * time.Hour)
yesterday := time.Now().UTC().Add(-24 * time.Hour)
testClock := clock.NewTestClock(yesterday)
statsDB, _ := newUniverseStatsWithDB(db.BaseDB, testClock)

Expand Down

0 comments on commit aa8d776

Please sign in to comment.