MCPcopy Create free account
hub / github.com/cogentcore/core / setAutoUnit

Method setAutoUnit

core/timepicker.go:433–441  ·  view source on GitHub ↗

setAutoUnit sets the [DurationInput.Unit] automatically based on the current duration.

()

Source from the content-addressed store, hash-verified

431
432// setAutoUnit sets the [DurationInput.Unit] automatically based on the current duration.
433func (di *DurationInput) setAutoUnit() {
434 di.Unit = durationUnits[0]
435 for _, u := range durationUnits {
436 if durationUnitsMap[u] > di.Duration {
437 break
438 }
439 di.Unit = u
440 }
441}
442
443var durationUnits = []string{
444 "nanoseconds",

Callers 1

InitMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected