Created
February 5, 2014 04:59
-
-
Save l1x/8817664 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn epoch | |
"Returns (System/currentTimeMillis)/1000" | |
[] | |
(int (/ (System/currentTimeMillis) 1000))) | |
(defn epoch-min | |
"Returns the epoch-min, to any epoch input | |
epoch min is the the last minute's epoch value | |
1390086540 1390086600 1390086660" | |
[epoch] | |
(- epoch (mod epoch 60))) | |
(defn last-datapoints | |
"Return a vector with n elements starting with epoch" | |
[epoch n] | |
(let [e (epoch-min epoch)] | |
(vec (map #(- e (* % 60)) (range n))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment