mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
JS: Utility function to convert ripple epoch to JS timestamp.
This commit is contained in:
@@ -3,6 +3,8 @@ exports.Amount = require('./amount').Amount;
|
|||||||
exports.UInt160 = require('./amount').UInt160;
|
exports.UInt160 = require('./amount').UInt160;
|
||||||
exports.Seed = require('./amount').Seed;
|
exports.Seed = require('./amount').Seed;
|
||||||
|
|
||||||
|
exports.utils = require('./utils');
|
||||||
|
|
||||||
// Important: We do not guarantee any specific version of SJCL or for any
|
// Important: We do not guarantee any specific version of SJCL or for any
|
||||||
// specific features to be included. The version and configuration may change at
|
// specific features to be included. The version and configuration may change at
|
||||||
// any time without warning.
|
// any time without warning.
|
||||||
|
|||||||
@@ -97,6 +97,15 @@ var assert = function (assertion, msg) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a ripple epoch to a JavaScript timestamp.
|
||||||
|
*
|
||||||
|
* JavaScript timestamps are unix epoch in milliseconds.
|
||||||
|
*/
|
||||||
|
var toTimestamp = function (rpepoch) {
|
||||||
|
return (rpepoch + 0x386D4380) * 1000;
|
||||||
|
};
|
||||||
|
|
||||||
exports.trace = trace;
|
exports.trace = trace;
|
||||||
exports.arraySet = arraySet;
|
exports.arraySet = arraySet;
|
||||||
exports.hexToString = hexToString;
|
exports.hexToString = hexToString;
|
||||||
@@ -106,5 +115,6 @@ exports.stringToHex = stringToHex;
|
|||||||
exports.chunkString = chunkString;
|
exports.chunkString = chunkString;
|
||||||
exports.logObject = logObject;
|
exports.logObject = logObject;
|
||||||
exports.assert = assert;
|
exports.assert = assert;
|
||||||
|
exports.toTimestamp = toTimestamp;
|
||||||
|
|
||||||
// vim:sw=2:sts=2:ts=8:et
|
// vim:sw=2:sts=2:ts=8:et
|
||||||
|
|||||||
Reference in New Issue
Block a user