Groups
Conversations
All groups and messages
Send feedback to Google
Help
Training
Sign in
Groups
Clojure Dev
Conversations
About
ClojureClr time function
79 views
Skip to first unread message
Martynas Drobulis
unread,
Apr 4, 2017, 1:53:11 PM
4/4/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Clojure Dev
Hello,
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.
- Martynas
Alex Miller
unread,
Apr 4, 2017, 1:57:22 PM
4/4/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Clojure Dev
Hey Martynas,
It's probably best to discuss this on the clojure-clr mailing list:
https://groups.google.com/forum/#!forum/clojure-clr
Alex
Reply all
Reply to author
Forward
0 new messages