@zandor300/jsmodbus
Version:
Implementation for the Serial/TCP Modbus protocol.
21 lines (20 loc) • 638 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserRequestMetrics = void 0;
class UserRequestMetrics {
constructor() {
this.createdAt = new Date();
this.startedAt = new Date();
this.receivedAt = new Date();
}
get transferTime() {
return this.receivedAt.getTime() - this.startedAt.getTime();
}
get waitTime() {
return this.startedAt.getTime() - this.createdAt.getTime();
}
toJSON() {
return Object.assign(Object.assign({}, this), { transferTime: this.transferTime });
}
}
exports.UserRequestMetrics = UserRequestMetrics;