View Code? Open in Web Editor
NEW
https://gitlab.gnous.eu/ada/atp
License: Mozilla Public License 2.0
atp's Introduction
A go lib for parsing human readable time duration
This library parses 1d1h1m1s
format similarly to gostd time.Duration()
.
Why write a library instead of using time.Duration()
?
Because the standard library does not support the day unit.
package main
import (
"gitlab.gnous.eu/ada/atp"
"fmt"
)
func main() {
t, err := atp.ParseDuration("1d2h")
if err != nil {
panic(err)
}
fmt.Println(t)
}
atp's People
Contributors
Watchers