Fix TestLinkMetadataStore test failing for some (#15057)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
484e813dca
Коммит
fe15ec4ae5
@@ -171,9 +171,9 @@ func (o *LinkMetadata) DeserializeDataToConcreteType() error {
|
|||||||
|
|
||||||
// FloorToNearestHour takes a timestamp (in milliseconds) and returns it rounded to the previous hour in UTC.
|
// FloorToNearestHour takes a timestamp (in milliseconds) and returns it rounded to the previous hour in UTC.
|
||||||
func FloorToNearestHour(ms int64) int64 {
|
func FloorToNearestHour(ms int64) int64 {
|
||||||
t := time.Unix(0, ms*int64(1000*1000))
|
t := time.Unix(0, ms*int64(1000*1000)).UTC()
|
||||||
|
|
||||||
return time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), 0, 0, 0, t.Location()).UnixNano() / int64(time.Millisecond)
|
return time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), 0, 0, 0, time.UTC).UnixNano() / int64(time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isRoundedToNearestHour returns true if the given timestamp (in milliseconds) has been rounded to the nearest hour in UTC.
|
// isRoundedToNearestHour returns true if the given timestamp (in milliseconds) has been rounded to the nearest hour in UTC.
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
var linkMetadataTimestamp int64 = 1546300800000
|
var linkMetadataTimestamp int64 = 1546300800000
|
||||||
|
|
||||||
func getNextLinkMetadataTimestamp() int64 {
|
func getNextLinkMetadataTimestamp() int64 {
|
||||||
linkMetadataTimestamp += int64(time.Hour) / 1000
|
linkMetadataTimestamp += int64(time.Hour) / (1000 * 1000)
|
||||||
return linkMetadataTimestamp
|
return linkMetadataTimestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user