Skip to content

Commit 8e4612a

Browse files
committed
updated Date.now() to performance
1 parent e0b7be2 commit 8e4612a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/api/api.controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class ApiController {
7979
@Query() params: SendOtpDto,
8080
@Headers('x-application-id') applicationId?,
8181
): Promise<any> {
82-
const startTime = Date.now();
82+
const startTime = ((performance.timeOrigin + performance.now()) * 1000);
8383

8484
let status: any,
8585
isWhatsApp = false,
@@ -136,7 +136,7 @@ export class ApiController {
136136
{
137137
botId: params.botId,
138138
orgId: params.orgId,
139-
timeTaken: Date.now() - startTime,
139+
timeTaken: ((performance.timeOrigin + performance.now()) * 1000) - startTime,
140140
createdAt: Math.floor(new Date().getTime() / 1000),
141141
phoneNumber: params.phone,
142142
eventLog: `Response from OTP provider - ${status.providerSuccessResponse}`,
@@ -430,7 +430,7 @@ export class ApiController {
430430
@Headers('authorization') authHeader,
431431
@Headers('ADMIN-API-KEY') adminApiKey,
432432
): Promise<any> {
433-
const startTime = Date.now();
433+
const startTime = ((performance.timeOrigin + performance.now()) * 1000);
434434
if (adminApiKey != this.configService.get('ADMIN_API_KEY')) {
435435
const response: SignupResponse = new SignupResponse().init(uuidv4());
436436
response.responseCode = ResponseCode.FAILURE;
@@ -445,7 +445,7 @@ export class ApiController {
445445
{
446446
botId: user.botId,
447447
orgId: null,
448-
timeTaken: Date.now() - startTime,
448+
timeTaken: ((performance.timeOrigin + performance.now()) * 1000) - startTime,
449449
createdAt: Math.floor(new Date().getTime() / 1000),
450450
userId: response.result.data.user.id,
451451
eventLog: `Status from Fusionauth - ${response.responseCode}`,

0 commit comments

Comments
 (0)