Fix error subtracting time zone diff to time set command

This commit is contained in:
Victor 2021-02-18 21:38:11 +01:00 committed by GitHub
parent fa0ba6be31
commit 99f073ba84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -955,7 +955,7 @@ class PlejBLEHandler extends EventEmitter {
`Plejd clock time off by more than 1 minute. Reported time: ${plejdTime.toString()}, diff ${diffSeconds} seconds. Time will be set hourly.`, `Plejd clock time off by more than 1 minute. Reported time: ${plejdTime.toString()}, diff ${diffSeconds} seconds. Time will be set hourly.`,
); );
if (this.connectedDevice && deviceId === this.connectedDevice.id) { if (this.connectedDevice && deviceId === this.connectedDevice.id) {
const newLocalTimestamp = (now.getTime() - offsetSecondsGuess) / 1000; const newLocalTimestamp = now.getTime() / 1000 - offsetSecondsGuess;
logger.info(`Setting time to ${now.toString()}`); logger.info(`Setting time to ${now.toString()}`);
const payload = Buffer.alloc(10); const payload = Buffer.alloc(10);
// E.g: 00 0110 001b 38df2360 00 // E.g: 00 0110 001b 38df2360 00