Files
Go-tool/util/timed/TimeCompareUtil.go
T

28 lines
613 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* @Author : huangzj
* @Time : 2020/5/7 12:00
* @Description 时间比较工具
*/
package timed
func IsBefore(timestamp, compareStamp int64) bool {
return timestamp < compareStamp
}
func IsAfter(timestamp, compareStamp int64) bool {
return timestamp > compareStamp
}
func IsSameTime(timestamp, compareStamp int64) bool {
return timestamp == compareStamp
}
func IsDiffTime(timestamp, compareStamp int64) bool {
return !IsSameTime(timestamp, compareStamp)
}
func IsBetween(timeStamp, compareBefore, compareAfter int64) bool {
return timeStamp >= compareBefore && timeStamp <= compareAfter
}