MCPcopy
hub / github.com/dgraph-io/dgraph / FixedDuration

Function FixedDuration

x/x.go:725–734  ·  view source on GitHub ↗

FixedDuration returns the given duration as a string of fixed length.

(d time.Duration)

Source from the content-addressed store, hash-verified

723
724// FixedDuration returns the given duration as a string of fixed length.
725func FixedDuration(d time.Duration) string {
726 str := fmt.Sprintf("%02ds", int(d.Seconds())%60)
727 if d >= time.Minute {
728 str = fmt.Sprintf("%02dm", int(d.Minutes())%60) + str
729 }
730 if d >= time.Hour {
731 str = fmt.Sprintf("%02dh", int(d.Hours())) + str
732 }
733 return str
734}
735
736// PageRange returns start and end indices given pagination params. Note that n
737// is the size of the input list.

Callers 5

reportOnceMethod · 0.92
endSummaryMethod · 0.92
printCountersMethod · 0.92
ProgressMethod · 0.92
ProgressMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected