From 344a698654bb22fa9a43da56b204110d9a8a3a17 Mon Sep 17 00:00:00 2001 From: ItsRiprod Date: Wed, 11 Dec 2024 04:44:59 -0700 Subject: [PATCH] Updated time for v0.10.3 --- DeskThingServer/package.json | 2 +- DeskThingServer/src/main/services/client/clientUtils.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DeskThingServer/package.json b/DeskThingServer/package.json index 036938e..ce1c2c4 100644 --- a/DeskThingServer/package.json +++ b/DeskThingServer/package.json @@ -1,6 +1,6 @@ { "name": "deskthing", - "version": "0.10.2", + "version": "0.10.3", "description": "A DeskThing server UI to interface with the DeskThing car thing app", "main": "./out/main/index.js", "author": "Riprod", diff --git a/DeskThingServer/src/main/services/client/clientUtils.ts b/DeskThingServer/src/main/services/client/clientUtils.ts index f0530c0..15ca752 100644 --- a/DeskThingServer/src/main/services/client/clientUtils.ts +++ b/DeskThingServer/src/main/services/client/clientUtils.ts @@ -1,5 +1,7 @@ console.log('[ClientUtils Service] Starting') +import loggingStore from '@server/stores/loggingStore' import { sendMessageToClients } from './clientCom' +import { MESSAGE_TYPES } from '@shared/types' const getDelayToNextMinute = async (): Promise => { const now = new Date() @@ -24,13 +26,16 @@ export const getDeviceType = (userAgent: string | undefined): { id: number; name export const sendTime = async (): Promise => { const now = new Date() - const utcTime = now.getTime() // UTC time in milliseconds + const utcTime = Date.now() // UTC time in milliseconds const timezoneOffset = now.getTimezoneOffset() * -1 // Offset in minutes (server's timezone) const data = { utcTime, // UTC timestamp timezoneOffset // Timezone offset in minutes } + + loggingStore.log(MESSAGE_TYPES.DEBUG, 'Sending time:' + JSON.stringify(data)) + sendMessageToClients({ app: 'client', type: 'set', request: 'time', payload: data }) }