feat(Go-Tool):创建timed包相关时间操作工具,实现时间戳、时间格式化操作。创建timed测试类

This commit is contained in:
huangzj
2020-05-07 16:14:37 +08:00
parent d448fbad5e
commit 24c319a182
13 changed files with 554 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
/*
* @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
}