Created
June 3, 2017 10:55
-
-
Save mohayonao/cf6e556a4f9d40cb8058576836c5d242 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
"use strict"; | |
function toTime(hi, lo) { | |
hi >>>= 0; | |
lo >>>= 0; | |
var seconds = hi - 2208988800; | |
var milliseconds = lo / 4294967296; | |
return (seconds + milliseconds) * 1000; | |
} | |
function fromTime(time) { | |
time = time / 1000 + 2208988800; | |
var hi = time >>> 0; | |
var lo = ((time - hi) * 4294967296) >>> 0; | |
return [ hi, lo ]; | |
} | |
module.exports = { toTime: toTime, fromTime: fromTime }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment