satellite/satellitedb: fix roundToNextDay to handle timezones appropriately
Since incoming times may be in any time zone, and we want the output to be in UTC and for them to have 00:00:00 hours, minutes and seconds we first convert the incoming timestamp to UTC before doing the truncate to the day and adding a day. Because the old code always returned a timestamp that was in the future, this is just for efficiency. Change-Id: Ie692d47bca8691e73852c822d5c56cf8773d99b4
This commit is contained in:
parent
0c0b47823d
commit
75314a4364
@ -329,7 +329,8 @@ func (db *ordersDB) ProcessOrders(ctx context.Context, requests []*orders.Proces
|
||||
}
|
||||
|
||||
func roundToNextDay(t time.Time) time.Time {
|
||||
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location()).AddDate(0, 0, 1).UTC()
|
||||
t = t.UTC()
|
||||
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location()).AddDate(0, 0, 1)
|
||||
}
|
||||
|
||||
// GetBillableBandwidth gets total billable (expired consumed serial) bandwidth for nodes and buckets for all actions.
|
||||
|
Loading…
Reference in New Issue
Block a user