cmd/bosun: func to turn seconds (scalars) to duration string #1669

Merged
merged 1 commit into from Mar 15, 2016

Projects

None yet

2 participants

@kylebrandt
Member

No description provided.

@kylebrandt
Member

Part of what would be needed for #1656

@kylebrandt kylebrandt added the bosun label Mar 15, 2016
@kylebrandt
Member

Actually, Fixes #1656

@captncraig captncraig commented on an outdated diff Mar 15, 2016
opentsdb/duration.go
+ if d >= Week && d%Week == 0 {
+ return fmt.Sprintf("%dw", d/Week)
+ }
+ if d >= Day && d%Day == 0 {
+ return fmt.Sprintf("%dd", d/Day)
+ }
+ if d >= Hour && d%Hour == 0 {
+ return fmt.Sprintf("%dh", d/Hour)
+ }
+ if d >= Minute && d%Minute == 0 {
+ return fmt.Sprintf("%dh", d/Minute)
+ }
+ if d >= Second && d%Second == 0 {
+ return fmt.Sprintf("%ds", d/Second)
+ }
+ return fmt.Sprintf("%dms", time.Duration(d).Nanoseconds()/1e6)
@captncraig
captncraig Mar 15, 2016 Contributor

/time.Millisecond

@kylebrandt kylebrandt cmd/bosun: func to turn seconds (scalars) to duration string
98aecb5
@kylebrandt kylebrandt merged commit 98aecb5 into master Mar 15, 2016

2 checks passed

bosun All checks Passed!
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@kylebrandt kylebrandt deleted the tod branch Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment