How do I get a Unix Timestamp in Clojure?

Pretty much all JVM-based timestamp mechanisms measure time as milliseconds since the epoch – so no, nothing standard** that will give seconds since epoch.

Your function can be slightly simplified as:

(quot (System/currentTimeMillis) 1000)

** Joda might have something like this, but pulling in a third-party library for this seems like overkill.

Leave a Comment