Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
time: add Duration-conversion functions Milliseconds() and Microseconds() #28564
I propose adding these two
func (d Duration) Milliseconds() float64 func (d Duration) Microseconds() float64
(these were already proposed in #5491 as
Here's a map of
If these are added, it might lead to suggestions for other similarly
What version of Go are you using (
@ianlancetaylor those were for different functions, but I mentioned them above too. The idea of a library to measure popularity is interesting, but I don't see how people would know it exists unless they come across these GH issues (which probably explains the low Star count on https://github.com/ulikunitz/unixtime).
Not that I know of; my main motivation was to lay out a case for why these should exist.
changed the title
time: add Duration-conversion functions Milliseconds() and Microseconds()
Nov 6, 2018
I'm sympathetic, since it's so easy to mistype the division (e.g. you have to remember NOT to type t.Nanoseconds() / 1000 for milliseconds).
The way you get float would be t.Seconds() * 1000 which is easy to remember.