Fork me on GitHub
#joker
<
2020-01-11
>
gleisonsilva14:01:30

Hello! Someone knows how to get the current time from OS using Joker?

gleisonsilva14:01:15

(i mean... without calling a shell or another executable in OS...)

jcburley14:01:41

See the joker.time namespace.

gleisonsilva14:01:35

I've seen, but I couldn't figure out. When I call joker.time/now I get back a #object[Proc] that I couldn't use in any place...

gleisonsilva14:01:55

I've tried call string, parse, etc on it, but uncessfully

jcburley14:01:52

A Proc is just an internally compiled Fn. I.e. you call it.

jcburley15:01:16

And it doesn't return just a String, but a Time object that you can further manipulate:

user=> (type (joker.time/now))
Time
user=> (joker.time/now)
2020-01-11 09:54:15.601988473 -0500 EST m=+9.694898411
user=> (let [cur (now)] (sleep (* second 3)) (println (sub (now) cur)))
3000091841
nil
user=> 

jcburley15:01:04

(Forgot to show the (use 'joker.time) in there before the (let ....)