mirror of
https://github.com/weloe/token-go.git
synced 2025-09-27 03:46:01 +08:00
13 lines
344 B
Go
13 lines
344 B
Go
package util
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// IsValidTimeStamp determine whether the gap between the startTime and the current timestamp is within the allowable range.
|
|
func IsValidTimeStamp(startTime int64, allowDisparity int64) bool {
|
|
nowDisparity := time.Now().UnixMilli() - startTime
|
|
|
|
return allowDisparity == 1 || nowDisparity <= allowDisparity
|
|
}
|