diff --git a/packages/core/src/utils/object-id.ts b/packages/core/src/utils/object-id.ts index 8cab59bab0..969fa7f8b7 100644 --- a/packages/core/src/utils/object-id.ts +++ b/packages/core/src/utils/object-id.ts @@ -19,8 +19,9 @@ along with this program. If not, see . const MACHINE_ID = Math.floor(Math.random() * 0xffffff); const pid = Math.floor(Math.random() * 100000) % 0xffff; +const PROCESS_UNIQUE = MACHINE_ID.toString(16).padStart(6, "0") + pid.toString(16).padStart(4, "0"); let index = Math.floor(Math.random() * 0xffffff); -const PROCESS_UNIQUE = MACHINE_ID.toString(16) + pid.toString(16); + export function createObjectId(date = Date.now()): string { index++; const time = Math.floor(date / 1000); @@ -40,4 +41,4 @@ function swap16(val: number) { export function getObjectIdTimestamp(id: string) { return new Date(parseInt(id.substring(0, 8), 16) * 1000); -} +} \ No newline at end of file