@aws-amplify/core
Version:
Core category of aws-amplify
22 lines (19 loc) • 791 B
JavaScript
import { isClockSkewed } from './isClockSkewed.mjs';
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* Returns the difference between clock time and the current system time if clock is skewed.
*
* @param clockTimeInMilliseconds Clock time in milliseconds.
* @param currentSystemClockOffset Current system clock offset in milliseconds.
*
* @internal
*/
const getUpdatedSystemClockOffset = (clockTimeInMilliseconds, currentSystemClockOffset) => {
if (isClockSkewed(clockTimeInMilliseconds, currentSystemClockOffset)) {
return clockTimeInMilliseconds - Date.now();
}
return currentSystemClockOffset;
};
export { getUpdatedSystemClockOffset };
//# sourceMappingURL=getUpdatedSystemClockOffset.mjs.map