You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/vendor/github.com/qiniu/go-sdk/v7/storage/util.go

23 lines
549 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package storage
import (
"time"
)
// ParsePutTime 提供了将PutTime转换为 time.Time 的功能
func ParsePutTime(putTime int64) (t time.Time) {
t = time.Unix(0, putTime*100)
return
}
// IsContextExpired 检查分片上传的ctx是否过期提前一天让它过期
// 因为我们认为如果断点继续上传的话最长需要1天时间
func IsContextExpired(blkPut BlkputRet) bool {
if blkPut.Ctx == "" {
return false
}
target := time.Unix(blkPut.ExpiredAt, 0).AddDate(0, 0, -1)
now := time.Now()
return now.After(target)
}