Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
george pogosyan committed Sep 3, 2024
1 parent 868a8f0 commit c421c57
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pipeline/doif/ts_cmp_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,19 @@ func (n *tsCmpOpNode) Check(eventRoot *insaneJSON.Root) bool {

lhs := int(timeVal.UnixNano())

rhs := 0
rhs := int64(0)
switch n.cmpValChangeMode {
case cmpValChangeModeNow:
rhs = int(n.varCmpValue.Load() + n.updateInterval.Nanoseconds() + n.cmpValueShift)
rhs = n.varCmpValue.Load() + n.updateInterval.Nanoseconds()
case cmpValChangeModeConst:
rhs = int(n.constCmpValue + n.cmpValueShift)
rhs = n.constCmpValue
default:
panic(fmt.Sprintf("impossible: invalid cmp value changing mode: %d", n.cmpValChangeMode))
}

return n.cmpOp.compare(lhs, rhs)
rhs += n.cmpValueShift

return n.cmpOp.compare(lhs, int(rhs))
}

func (n *tsCmpOpNode) isEqualTo(n2 Node, _ int) error {
Expand Down

0 comments on commit c421c57

Please sign in to comment.