Skip to content

Instantly share code, notes, and snippets.

@mohayonao
Created June 3, 2017 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohayonao/cf6e556a4f9d40cb8058576836c5d242 to your computer and use it in GitHub Desktop.
Save mohayonao/cf6e556a4f9d40cb8058576836c5d242 to your computer and use it in GitHub Desktop.
"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