https://github.com/gregoryv/uptime
Package uptime provides an easy textual representation of long durations.
https://github.com/gregoryv/uptime
Last synced: about 1 year ago
JSON representation
Package uptime provides an easy textual representation of long durations.
- Host: GitHub
- URL: https://github.com/gregoryv/uptime
- Owner: gregoryv
- License: mit
- Created: 2023-11-13T20:14:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-18T09:53:24.000Z (over 2 years ago)
- Last Synced: 2025-02-05T07:19:34.345Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Package [uptime](https://pkg.go.dev/github.com/gregoryv/uptime)
provides an easy textual representation of long durations.
## Quick start
$ go get -u github.com/gregoryv/uptime
Example
a := time.Date(1821, 1, 01, 12, 00, 00, 0, time.UTC)
b := time.Date(2022, 3, 07, 16, 00, 00, 0, time.UTC)
fmt.Println(uptime.Approximate(b.Sub(a)))
fmt.Println(uptime.Between(a, b))
// output:
// 201 years 3 months 24 days 4 hours
// 201 years 2 months 6 days 4 hours