mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Added fixes suggested in PR
This commit is contained in:
parent
9a74be1558
commit
e2be5ddc0c
2 changed files with 15 additions and 3 deletions
|
@ -2038,9 +2038,15 @@ RETSIGTYPE sig_handler(int signo);
|
|||
double current_time(bool real)
|
||||
{
|
||||
struct timeval tv;
|
||||
#ifdef _MSC_VER
|
||||
auto now = std::chrono::system_clock::now();
|
||||
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
|
||||
tv.tv_sec = ms.count() / 1000;
|
||||
tv.tv_usec = (ms.count() % 1000) * 1000;
|
||||
#else
|
||||
if ( gettimeofday(&tv, 0) < 0 )
|
||||
reporter->InternalError("gettimeofday failed in current_time()");
|
||||
|
||||
#endif
|
||||
double t = double(tv.tv_sec) + double(tv.tv_usec) / 1e6;
|
||||
|
||||
if ( ! run_state::pseudo_realtime || real || ! iosource_mgr || ! iosource_mgr->GetPktSrc() )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue