oO0XX0Oo
(Jack Walter)
1
Hi,
I use this in main.go:
start := time.Now()
// Do something
fmt.Printf("Execution time: %s", time.Since(start))
And the output is normally:
Execution time: 1.5994525s
How do I reformat this output to:
Execution time: 1.60 s
-> Rounding to two decimal places after the dot, a space, “s”?
oO0XX0Oo
(Jack Walter)
2
Got it…
fmt.Printf("Execution time: %.2f s", time.Now().Sub(start).Seconds())
system
(system)
Closed
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.