diff --git a/src/js/index.js b/src/js/index.js index 4ff2b374..b603d6a5 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -3,6 +3,8 @@ exports.Amount = require('./amount').Amount; exports.UInt160 = require('./amount').UInt160; exports.Seed = require('./amount').Seed; +exports.utils = require('./utils'); + // 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 // any time without warning. diff --git a/src/js/utils.js b/src/js/utils.js index d1779faf..462f3f28 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -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.arraySet = arraySet; exports.hexToString = hexToString; @@ -106,5 +115,6 @@ exports.stringToHex = stringToHex; exports.chunkString = chunkString; exports.logObject = logObject; exports.assert = assert; +exports.toTimestamp = toTimestamp; // vim:sw=2:sts=2:ts=8:et