Add DurationSeconds

This commit is contained in:
Slavomir 2021-10-06 23:26:35 +02:00
parent c4bcb52525
commit 136a3c3479
1 changed files with 11 additions and 1 deletions

View File

@ -329,5 +329,15 @@ func (res UnixTimeSeconds) Time() time.Time {
}
func (res UnixTimeSeconds) String() string {
return time.Unix(int64(res), 0).String()
return res.Time().String()
}
type DurationSeconds int64
func (res DurationSeconds) Duration() time.Duration {
return time.Duration(res) * time.Second
}
func (res DurationSeconds) String() string {
return res.Duration().String()
}