Add support for setting the current system date/time

#56
This commit is contained in:
2021-09-06 22:52:57 -05:00
parent f271554d89
commit a5d207d3aa
4 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,28 @@
'use strict';
const SLMessage = require('./SLMessage.js').SLMessage;
const MSG_ID = 8112;
exports.SLSetSystemTime = class SLSetSystemTime extends SLMessage {
constructor(buf, date, shouldAdjustForDST, senderId) {
if (buf) {
var size = buf.readInt32LE(4) + 8;
super(buf, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.date = date;
this.shouldAdjustForDST = shouldAdjustForDST;
}
}
encode() {
this.writeSLDateTime(this.date);
this.writeInt32LE(this.shouldAdjustForDST ? 1 : 0);
}
static getResponseId() {
return MSG_ID + 1;
}
};

View File

@ -26,3 +26,4 @@ exports.SLCancelDelay = require('./SLCancelDelay.js').SLCancelDelay;
exports.SLAddClient = require('./SLAddClient.js').SLAddClient;
exports.SLRemoveClient = require('./SLRemoveClient.js').SLRemoveClient;
exports.SLGetSystemTime = require('./SLGetSystemTime.js').SLGetSystemTime;
exports.SLSetSystemTime = require('./SLSetSystemTime.js').SLSetSystemTime;