-
-
Save suhailshergill/3467113 to your computer and use it in GitHub Desktop.
converting a bson datetime to an elisp time
This file contains hidden or 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
(defun bson-datetime-int64-to-time (byte-list) | |
(let ((calc-num | |
(concat | |
"16#" | |
(mapconcat | |
(lambda (x) (format "%02X" x)) | |
byte-list "")))) | |
(list | |
(calc-eval | |
"rsh(and(idiv($,1000),16#ffff0000),16)" | |
'rawnum | |
calc-num) | |
(calc-eval | |
"and(idiv($,1000),16#ffff)" | |
'rawnum | |
calc-num)))) | |
(format-time-string | |
"%D" | |
(bson-datetime-int64-to-time | |
(reverse (list #x40 #xa0 #x9f #xc3 #x2c #x01 #x00 #x00)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment