Files
token-go/util/sign.go
2023-06-09 19:41:30 +08:00

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
}