13 lines
353 B
Go
13 lines
353 B
Go
package utils
|
|
|
|
import "time"
|
|
|
|
// GetDurationInMillseconds takes a start time and returns a duration in milliseconds
|
|
func GetDurationInMillseconds(start time.Time) float64 {
|
|
end := time.Now()
|
|
duration := end.Sub(start)
|
|
milliseconds := float64(duration) / float64(time.Millisecond)
|
|
rounded := float64(int(milliseconds*100+.5)) / 100
|
|
return rounded
|
|
}
|