mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

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.
28 lines
879 B
Text
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)]);
|
|
}
|
|
|