Skip to content

Commit 8f0f10d

Browse files
committed
Store timestamps as Unix epoch seconds instead of milliseconds
1 parent 9467075 commit 8f0f10d

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎packages/vscode/src/context/providers/workspace/workspace-provider.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,10 @@ export class WorkspaceProvider
376376
created_file_path,
377377
vscode.TreeItemCheckboxState.Checked
378378
)
379-
this._checked_timestamps.set(created_file_path, Date.now())
379+
this._checked_timestamps.set(
380+
created_file_path,
381+
Math.floor(Date.now() / 1000)
382+
)
380383

381384
if (is_directory) {
382385
await this._update_directory_check_state(
@@ -984,7 +987,7 @@ export class WorkspaceProvider
984987
this._checked_items.set(key, state)
985988
if (state === vscode.TreeItemCheckboxState.Checked) {
986989
if (!this._checked_timestamps.has(key)) {
987-
this._checked_timestamps.set(key, Date.now())
990+
this._checked_timestamps.set(key, Math.floor(Date.now() / 1000))
988991
}
989992
} else {
990993
this._checked_timestamps.delete(key)
@@ -1157,7 +1160,10 @@ export class WorkspaceProvider
11571160
this._checked_items.set(full_path, state)
11581161
if (state === vscode.TreeItemCheckboxState.Checked) {
11591162
if (!this._checked_timestamps.has(full_path)) {
1160-
this._checked_timestamps.set(full_path, Date.now())
1163+
this._checked_timestamps.set(
1164+
full_path,
1165+
Math.floor(Date.now() / 1000)
1166+
)
11611167
}
11621168
} else {
11631169
this._checked_timestamps.delete(full_path)
@@ -1271,7 +1277,7 @@ export class WorkspaceProvider
12711277
const timestamp =
12721278
timestamps?.get(file_path) ??
12731279
old_timestamps.get(file_path) ??
1274-
Date.now()
1280+
Math.floor(Date.now() / 1000)
12751281
this._checked_timestamps.set(file_path, timestamp)
12761282
}
12771283

@@ -1395,7 +1401,7 @@ export class WorkspaceProvider
13951401
this._checked_items.set(key, vscode.TreeItemCheckboxState.Checked)
13961402

13971403
if (!this._checked_timestamps.has(key)) {
1398-
this._checked_timestamps.set(key, Date.now())
1404+
this._checked_timestamps.set(key, Math.floor(Date.now() / 1000))
13991405
}
14001406

14011407
this._partially_checked_dirs.delete(key)

0 commit comments

Comments
 (0)