UNPKG

540 BJavaScriptView Raw
1/**
2 * http://openid.net/specs/openid-connect-core-1_0.html states exp/iat times are in secs, not millis
3 *
4 * Taken from: https://github.com/christiansmith/anvil-connect/blob/master/lib/time-utils.js
5 *
6 * @param {long} deltaSecs optional delta to be added to "now", in seconds.
7 * @return {long} "now" in seconds, with deltaSecs added if it was supplied.
8 * @api private
9 */
10exports.nowSeconds = function (deltaSecs) {
11 var secs = Date.now()
12 secs = Math.round(secs / 1000)
13
14 if (deltaSecs) {
15 secs += deltaSecs
16 }
17 return secs
18}