forked from free-lancers/electricity_bill_calc_service
		
	enhance(utils):移动时间工具函数包的位置。
This commit is contained in:
		| @@ -1,9 +1,20 @@ | |||||||
| package tools | package time | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | var loc *time.Location = time.FixedZone("+0800", 8*60*60) | ||||||
|  | 
 | ||||||
|  | func Now() time.Time { | ||||||
|  | 	return time.Now().In(loc) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func Timestamp() int64 { | ||||||
|  | 	startline := time.Date(2022, 2, 22, 22, 22, 22, 0, loc).Unix() | ||||||
|  | 	return Now().Unix() - startline | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func DifferenceInMonth(t1, t2 time.Time) int { | func DifferenceInMonth(t1, t2 time.Time) int { | ||||||
| 	var differYear, differMonth int | 	var differYear, differMonth int | ||||||
| 	differYear = t1.Year() - t2.Year() | 	differYear = t1.Year() - t2.Year() | ||||||
		Reference in New Issue
	
	Block a user