set-system-clock
Version:
Sets the system date and time.
29 lines (28 loc) • 881 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const shared_1 = require("./shared");
const os = require("os");
class DateTimeControl {
constructor() {
if (!this.isSupported()) {
return;
}
let controller = shared_1.Controllers[os.platform()];
this.dateTimeControl = new controller();
}
setDateTime(dateTime, options) {
if (!this.isSupported()) {
return;
}
this.dateTimeControl.setDateTime(dateTime, options || {});
}
isSupported() {
if (shared_1.Controllers[os.platform()] === undefined) {
console.error('Unsupported system, unable to set system time.');
return false;
}
return true;
}
}
exports.DateTimeControl = DateTimeControl;
exports.default = new DateTimeControl();