zeek/testing/btest/core/event-metadata/current-event-time.zeek
Arne Welzel 7b4b1779bf Event: Use -1.0 for undefined/unset timestamps
This can happen if either there's no network timestamp associated with
an event, or there's currently no event being dispatched. Using 0.0
isn't great as it's the normal start timestamp before reading a network
packet. Using -1.0 gives the caller a chance to check and realize what's
going on.
2025-06-02 17:31:36 +02:00

14 lines
642 B
Text

# @TEST-DOC: Check current_event_time() produces the same as event metadata, or else -1.0
#
# @TEST-EXEC: zeek -r $TRACES/http/get.trace %INPUT EventMetadata::add_network_timestamp=T >> output 2>&1
# @TEST-EXEC: zeek -r $TRACES/http/get.trace %INPUT EventMetadata::add_network_timestamp=F >> output 2>&1
#
# @TEST-EXEC: TEST_DIFF_CANONIFIER= btest-diff output
event new_connection(c: connection)
{
print fmt("new_connection add_network_timestamp=%s current_event_time=%s network_timestamp=%s",
EventMetadata::add_network_timestamp, current_event_time(),
EventMetadata::current(EventMetadata::NETWORK_TIMESTAMP));
}