update treshold computation
This commit is contained in:
parent
73b1002451
commit
0d34554fab
4
dist/smarttime.classes.timestamp.d.ts
vendored
4
dist/smarttime.classes.timestamp.d.ts
vendored
@ -34,6 +34,6 @@ export declare class TimeStamp {
|
||||
* Is the current instance older than the argument
|
||||
* @param TimeStampArg
|
||||
*/
|
||||
isOlderThan(TimeStampArg: TimeStamp, compareTimeArg?: number): boolean;
|
||||
isYoungerThan(TimeStampArg: TimeStamp, compareTimeArg?: number): boolean;
|
||||
isOlderThan(TimeStampArg: TimeStamp, tresholdTimeArg?: number): boolean;
|
||||
isYoungerThan(TimeStampArg: TimeStamp, tresholdTimeArg?: number): boolean;
|
||||
}
|
||||
|
14
dist/smarttime.classes.timestamp.js
vendored
14
dist/smarttime.classes.timestamp.js
vendored
@ -38,20 +38,16 @@ class TimeStamp {
|
||||
* Is the current instance older than the argument
|
||||
* @param TimeStampArg
|
||||
*/
|
||||
isOlderThan(TimeStampArg, compareTimeArg) {
|
||||
if (this.milliSeconds < TimeStampArg.milliSeconds &&
|
||||
(!compareTimeArg ||
|
||||
(compareTimeArg && ((TimeStampArg.milliSeconds - this.milliSeconds) > compareTimeArg)))) {
|
||||
isOlderThan(TimeStampArg, tresholdTimeArg = 0) {
|
||||
if ((this.milliSeconds + tresholdTimeArg) < TimeStampArg.milliSeconds) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
isYoungerThan(TimeStampArg, compareTimeArg) {
|
||||
if (this.milliSeconds > TimeStampArg.milliSeconds &&
|
||||
(!compareTimeArg ||
|
||||
(compareTimeArg && ((this.milliSeconds - TimeStampArg.milliSeconds) > compareTimeArg)))) {
|
||||
isYoungerThan(TimeStampArg, tresholdTimeArg = 0) {
|
||||
if (this.milliSeconds > (TimeStampArg.milliSeconds + tresholdTimeArg)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -60,4 +56,4 @@ class TimeStamp {
|
||||
}
|
||||
}
|
||||
exports.TimeStamp = Time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UFBTSxDQUFDLGFBQWEsQ0FBRSxZQUF1QjtRQUMzQyxJQUFJLGNBQWMsR0FBRyxJQUFJLFNBQVMsRUFBRSxDQUFBO1FBQ3BDLGNBQWMsQ0FBQyxNQUFNLEdBQUcsY0FBYyxDQUFDLFlBQVksR0FBRyxZQUFZLENBQUMsWUFBWSxDQUFBO1FBQy9FLE1BQU0sQ0FBQyxjQUFjLENBQUE7SUFDdkIsQ0FBQztJQUVEOzs7T0FHRztJQUNILFdBQVcsQ0FBRSxZQUF1QixFQUFFLGtCQUEwQixDQUFDO1FBQy9ELEVBQUUsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLFlBQVksR0FBRyxlQUFlLENBQUMsR0FBRyxZQUFZLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUN0RSxNQUFNLENBQUMsSUFBSSxDQUFBO1FBQ2IsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ04sTUFBTSxDQUFDLEtBQUssQ0FBQTtRQUNkLENBQUM7SUFDSCxDQUFDO0lBRUQsYUFBYSxDQUFFLFlBQXVCLEVBQUUsa0JBQTBCLENBQUM7UUFDakUsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLFlBQVksR0FBRyxDQUFDLFlBQVksQ0FBQyxZQUFZLEdBQUcsZUFBZSxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBQ3RFLE1BQU0sQ0FBQyxJQUFJLENBQUE7UUFDYixDQUFDO1FBQUMsSUFBSSxDQUFDLENBQUM7WUFDTixNQUFNLENBQUMsS0FBSyxDQUFBO1FBQ2QsQ0FBQztJQUNILENBQUM7Q0FDRjtBQXBFRCw4QkFvRUMifQ==
|
@ -57,32 +57,16 @@ export class TimeStamp {
|
||||
* Is the current instance older than the argument
|
||||
* @param TimeStampArg
|
||||
*/
|
||||
isOlderThan (TimeStampArg: TimeStamp, compareTimeArg?: number) {
|
||||
if (
|
||||
this.milliSeconds < TimeStampArg.milliSeconds &&
|
||||
(
|
||||
!compareTimeArg ||
|
||||
(
|
||||
compareTimeArg && ((TimeStampArg.milliSeconds - this.milliSeconds) > compareTimeArg)
|
||||
)
|
||||
)
|
||||
) {
|
||||
isOlderThan (TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) {
|
||||
if ((this.milliSeconds + tresholdTimeArg) < TimeStampArg.milliSeconds) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
isYoungerThan (TimeStampArg: TimeStamp, compareTimeArg?: number) {
|
||||
if (
|
||||
this.milliSeconds > TimeStampArg.milliSeconds &&
|
||||
(
|
||||
!compareTimeArg ||
|
||||
(
|
||||
compareTimeArg && ((this.milliSeconds - TimeStampArg.milliSeconds) > compareTimeArg)
|
||||
)
|
||||
)
|
||||
) {
|
||||
isYoungerThan (TimeStampArg: TimeStamp, tresholdTimeArg: number = 0) {
|
||||
if (this.milliSeconds > (TimeStampArg.milliSeconds + tresholdTimeArg)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
Loading…
Reference in New Issue
Block a user