zeek/testing/btest/scripts/base/frameworks/logging/ascii-timestamps.zeek
Jon Siwek cc15c985ca GH-1450: Improve printing/logging of large double/interval/time values
The modp_dtoa/modp_dtoa2 functions aren't capable of handling double
values larger than INT_MAX and fallback on using sprintf() in that
situation.  Previously, the format string to that sprintf() was "%e",
defaulting to a precision of 6, which is already too few digits to
represent a number known to be larger than INT_MAX.  Now, an sprintf()
is still performed for values larger than INT_MAX and still uses a
scientific notation format, but in a way that uses as many decimal
digits as needed to preserve information.
2021-04-06 19:54:02 -07:00

28 lines
879 B
Text

#
# @TEST-EXEC: zeek -b %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-openclose-timestamps btest-diff test.log
module Test;
export {
redef enum Log::ID += { LOG };
type Info: record {
data: time &log;
};
}
event zeek_init()
{
Log::create_stream(Test::LOG, [$columns=Info]);
Log::write(Test::LOG, [$data=double_to_time(1234567890)]);
Log::write(Test::LOG, [$data=double_to_time(1234567890.0)]);
Log::write(Test::LOG, [$data=double_to_time(1234567890.01)]);
Log::write(Test::LOG, [$data=double_to_time(1234567890.001)]);
Log::write(Test::LOG, [$data=double_to_time(1234567890.0001)]);
Log::write(Test::LOG, [$data=double_to_time(1234567890.00001)]);
Log::write(Test::LOG, [$data=double_to_time(1234567890.000001)]);
Log::write(Test::LOG, [$data=double_to_time(1234567890.0000001)]);
Log::write(Test::LOG, [$data=double_to_time(2385642157)]);
}