UNPKG

1.26 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright (c) Microsoft Corporation. All rights reserved.
4 * Licensed under the MIT License.
5 */
6Object.defineProperty(exports, "__esModule", { value: true });
7exports.TimeUtils = void 0;
8/**
9 * @hidden
10 */
11var TimeUtils = /** @class */ (function () {
12 function TimeUtils() {
13 }
14 /**
15 * Returns time in seconds for expiration based on string value passed in.
16 *
17 * @param expiresIn
18 */
19 TimeUtils.parseExpiresIn = function (expiresIn) {
20 // if AAD did not send "expires_in" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as "expires_in" value instead of 3600
21 var expires = expiresIn || "3599";
22 return parseInt(expires, 10);
23 };
24 /**
25 * Return the current time in Unix time (seconds). Date.getTime() returns in milliseconds.
26 */
27 TimeUtils.now = function () {
28 return Math.round(new Date().getTime() / 1000.0);
29 };
30 /**
31 * Returns the amount of time in milliseconds since the page loaded.
32 */
33 TimeUtils.relativeNowMs = function () {
34 return window.performance.now();
35 };
36 return TimeUtils;
37}());
38exports.TimeUtils = TimeUtils;
39//# sourceMappingURL=TimeUtils.js.map
\No newline at end of file