Skip to content

Instantly share code, notes, and snippets.

@cathoderay
Created November 27, 2010 16:34
Show Gist options
  • Save cathoderay/718042 to your computer and use it in GitHub Desktop.
Save cathoderay/718042 to your computer and use it in GitHub Desktop.
modification of time (core) function to return the elapsed time in float, instead of formated string.
(defn my-time
"This is a construction above core 'time' function to
return the time elapsed as a float, instead of a formated string.
Usage example: (my-time + 2 1)"
[f & args]
(Float/parseFloat (first (re-find #"(\d+\.\d+)" (with-out-str (time (apply f args)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment