(time) fn does not return partial milliseconds

Description

"

ClojureClr time retuns only full milliseconds

user=> (time (conj '() 1))
"Elapsed time: 0 msecs"
(1)

versus Clojure on JVM

user=> (time (conj '() 1))
"Elapsed time: 0.038176 msecs"
(1)

I've found that time fn in ClojureClr

https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure.Source/clojure/core.clj#L3843

Uses the RT.cs function StopStopwatch.

https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure/Lib/RT.cs#L3308

StopStopwatch returns only full milliseconds.

a simple fix like this

public static double StopStopwatch()
{
_stopwatch.Stop();
return _stopwatch.Elapsed.
TotalMilliseconds;
}

would return whole and fractional milliseconds as a double.

The return type changes from long to double, so i'm not sure if it breaks any other code.

"

NOted by Martynas Drobulis, https://groups.google.com/forum/#!topic/clojure-clr/k9QX7GQUn-M

Environment

None

Activity

Show:
David Miller
April 8, 2017, 8:15 PM

Commit 21f3fb5, 2017.04.08.

Completed

Assignee

David Miller

Reporter

David Miller