Skip to content

Commit

Permalink
Merge pull request #88 from ItsRiprod/v0.10.0
Browse files Browse the repository at this point in the history
Updated time for v0.10.3
  • Loading branch information
ItsRiprod authored Dec 11, 2024
2 parents c3b5da3 + 344a698 commit 635bda2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DeskThingServer/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 6 additions & 1 deletion DeskThingServer/src/main/services/client/clientUtils.ts
Original file line number Diff line number Diff line change
@@ -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<number> => {
const now = new Date()
Expand All @@ -24,13 +26,16 @@ export const getDeviceType = (userAgent: string | undefined): { id: number; name

export const sendTime = async (): Promise<void> => {
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 })
}

Expand Down

0 comments on commit 635bda2

Please sign in to comment.