mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
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.
This commit is contained in:
parent
e2e13902f3
commit
7b4b1779bf
5 changed files with 29 additions and 4 deletions
|
@ -96,7 +96,7 @@ zeek::VectorValPtr Event::MetadataValues(const EnumValPtr& id) const {
|
|||
|
||||
double Event::Time() const {
|
||||
if ( ! meta )
|
||||
return 0.0;
|
||||
return detail::NO_TIMESTAMP;
|
||||
|
||||
for ( const auto& m : *meta )
|
||||
if ( m.Id() == static_cast<zeek_uint_t>(detail::MetadataType::NetworkTimestamp) ) {
|
||||
|
@ -109,7 +109,7 @@ double Event::Time() const {
|
|||
return m.Val()->AsTime();
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
return detail::NO_TIMESTAMP;
|
||||
}
|
||||
|
||||
void Event::Describe(ODesc* d) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue