feat(Go-Tool):

2021/02/23:删除linq包使用示例,修改二进制工具与单测类,修改lomuto划分,修改前缀树与单测类,修改时间比较工具
This commit is contained in:
Huangzj
2021-02-23 10:57:41 +08:00
parent 39cee0ce6a
commit 74dd19c675
14 changed files with 98 additions and 794 deletions
+14
View File
@@ -136,6 +136,20 @@ func GetIntervalBetweenTimes(timestamp, stamp int64) vo.IntervalObj {
}
// 获取两个时间点之间相差多少天
func GetIntervalDay(beforeTime, afterTime time.Time) int {
timestamp := beforeTime.Unix()
stamp := afterTime.Unix()
//时间大小保证前小后大
if timestamp > stamp {
timestamp, stamp = stamp, timestamp
}
timeBefore := time.Unix(timestamp, 0)
timeAfter := time.Unix(stamp, 0)
m := timeAfter.Sub(timeBefore)
return int(m.Hours() / 24)
}
/*
* @param timestamp 时间戳
* @param stamp 时间戳