mirror of
https://gitee.com/rulego/streamsql.git
synced 2025-07-06 07:58:32 +00:00
9 lines
176 B
Go
9 lines
176 B
Go
package timex
|
|
|
|
import "time"
|
|
|
|
func AlignTimeToWindow(t time.Time, size time.Duration) time.Time {
|
|
offset := t.UnixNano() % int64(size)
|
|
return t.Add(time.Duration(-offset))
|
|
}
|