Standard library / time
time.Duration.Abs()
Return absolute duration, mapping the minimum int64 duration to the maximum because its positive counterpart is not representable. Expected stdout: '3s\n'.
Formal Syntax & Structure
go syntaxgo
func (d Duration) Abs() DurationReturn Value
Duration
Return absolute duration, mapping the minimum int64 duration to the maximum because its positive counterpart is not representable.
Working Example
Example Snippetgo
package main
import ( "fmt" "time")
func main() { fmt.Println((-3 * time.Second).Abs()) }