Skip to content

Commit cb8b206

Browse files
authored
Use performance.now() to replace Date.now() (#1196)
1 parent cc98762 commit cb8b206

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/extension.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function initializeExtension(_operationId: string, context: vscode.Extensi
4343
initRecommendations(context);
4444
initDaemon(context);
4545

46-
activatedTimestamp = Date.now();
46+
activatedTimestamp = performance.now();
4747
if(context.storageUri) {
4848
const javaWorkspaceStoragePath = path.join(context.storageUri.fsPath, "..", "redhat.java");
4949
cleanJavaWorkspaceIndicator = path.join(javaWorkspaceStoragePath, "jdt_ws", ".cleanWorkspace");
@@ -100,11 +100,10 @@ function initializeTelemetry(_context: vscode.ExtensionContext) {
100100
}
101101

102102
export async function deactivate() {
103-
const now = Date.now();
103+
const now = performance.now();
104104
const data = {
105105
name: "sessionStatus",
106-
timestamp: now.toString(),
107-
time: now - activatedTimestamp
106+
time: Math.round(now - activatedTimestamp)
108107
}
109108
if (cleanJavaWorkspaceIndicator && fs.existsSync(cleanJavaWorkspaceIndicator)) {
110109
data.name = "cleanJavaLSWorkspace";

0 commit comments

Comments
 (0)