Skip to content

Commit

Permalink
moonsniff: work-around for weird timestamp overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
emmericp committed Dec 18, 2018
1 parent de1fd29 commit ee8f575
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/moonsniff/arrmatch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ function computeLatency(postcap, postreader, map, misses)

if pre_identifier == post_identifier then
local diff = ffi.cast(INT64_T, getTs(postcap) - ts)

-- handle weird overflow bug that was introduced when we moved to the C++ capturer
-- no idea what exactly causes this, but this work-around fixes it for all latencies less than 2 seconds
if ts ~= 0 and diff < -2^31 and diff > -2^32 then
diff = diff + 2^32
end
if ts ~= 0 and diff < TIME_THRESH then
log:warn("Got latency smaller than defined thresh value")
log:warn("Identification " .. ident)
Expand Down

0 comments on commit ee8f575

Please sign in to comment.