diff --git a/src/zeek.bif b/src/zeek.bif index fceaa3ac5f..18a83c2ec2 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -2399,7 +2399,7 @@ function double_to_time%(d: double%): time ## .. zeek:see:: interval_to_double function double_to_interval%(d: double%): interval %{ - return make_intrusive(d, TYPE_INTERVAL); + return make_intrusive(d, Seconds); %} ## Converts a :zeek:type:`port` to a :zeek:type:`count`. diff --git a/testing/btest/Baseline/bifs.to_interval/out b/testing/btest/Baseline/bifs.to_interval/out index d841f8d99a..df639fecfe 100644 --- a/testing/btest/Baseline/bifs.to_interval/out +++ b/testing/btest/Baseline/bifs.to_interval/out @@ -1,2 +1,3 @@ -1234563.14 --1234563.14 +interval, 14.0 days 6.0 hrs 56.0 mins 3.0 secs 139.0 msecs 999.999898 usecs +interval, -14.0 days -6.0 hrs -56.0 mins -3.0 secs -139.0 msecs -999.999898 usecs +interval, 6.0 secs diff --git a/testing/btest/bifs/to_interval.zeek b/testing/btest/bifs/to_interval.zeek index a9bab7b675..2e19e423f6 100644 --- a/testing/btest/bifs/to_interval.zeek +++ b/testing/btest/bifs/to_interval.zeek @@ -4,8 +4,10 @@ event zeek_init() { - local a = 1234563.14; - print double_to_interval(a); - local b = -1234563.14; - print double_to_interval(b); + local a = double_to_interval(1234563.140); + print type_name(a), a; + local b = double_to_interval(-1234563.14); + print type_name(b), b; + local c = double_to_interval(6.0); + print type_name(c), c; }