mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
ttl fix: 3y was converted into 96m
This commit is contained in:
parent
5fb60b7135
commit
a83b8e7b01
|
@ -134,7 +134,7 @@ func (t TTL) Minutes() uint32 {
|
|||
case Week:
|
||||
return uint32(t.Count) * 60 * 24 * 7
|
||||
case Month:
|
||||
return uint32(t.Count) * 60 * 24 * 31
|
||||
return uint32(t.Count) * 60 * 24 * 30
|
||||
case Year:
|
||||
return uint32(t.Count) * 60 * 24 * 365
|
||||
}
|
||||
|
@ -145,5 +145,23 @@ func SecondsToTTL(seconds int32) string {
|
|||
if seconds == 0 {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%dm", seconds/60)
|
||||
if seconds/60 < 256 {
|
||||
return fmt.Sprintf("%dm", seconds/60)
|
||||
}
|
||||
if seconds/(3600) < 256 {
|
||||
return fmt.Sprintf("%dh", seconds/(3600))
|
||||
}
|
||||
if seconds/(3600*24) < 256 {
|
||||
return fmt.Sprintf("%dd", seconds/(3600*24))
|
||||
}
|
||||
if seconds/(3600*24*7) < 256 {
|
||||
return fmt.Sprintf("%dw", seconds/(3600*24*7))
|
||||
}
|
||||
if seconds/(3600*24*30) < 256 {
|
||||
return fmt.Sprintf("%dM", seconds/(3600*24*30))
|
||||
}
|
||||
if seconds/(3600*24*365) < 256 {
|
||||
return fmt.Sprintf("%dy", seconds/(3600*24*365))
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue