Is it possible to cast the Elapsed Time function to Integer?

Posted by nuvio on Stack Overflow See other posts from Stack Overflow or by nuvio
Published on 2012-04-05T22:05:54Z Indexed on 2012/04/05 23:28 UTC
Read the original article Hit count: 213

Filed under:
|
|
|
|

I have the following function:

(def elapsedtime (with-out-str (time (run-my-function))))

and I was wondering if is possible to store only the integer value of the time, as I can only store a String at the moment....

Any suggestion? Thanks a lot

UPDATE

So I did use this:
  (defmacro nsecs
  [expr]
  `(let [start# (. System (nanoTime))]
     ~expr
     (- (. System (nanoTime)) start#)))

And then modified this:

(def elapsedtime (nsecs (run-my-function argument1 argument2)))

but doesn't work, what am I doing wrong?

"Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Wrong number of args (1) passed to: main$fn--105$nsecs"

© Stack Overflow or respective owner

Related posts about string

Related posts about time