From bab24a88ab48e18506bb00c6418a76ef77f77f49 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 16 Jul 2019 20:10:08 +0200 Subject: viml/profile: revert proftime_T to unsigned type #10521 - reltimestr(): Produce negative value by comparing the unsigned proftime_T value to INT64_MAX. https://github.com/neovim/neovim/issues/10452#issuecomment-511155132 1. The interfaces of nearly all platforms return uint64_t. INT64_MAX is only half of that. 2. Low-level interfaces like this typically define that there is no fixed starting point. The only guarantees are that it's (a) monotonically increasing at a rate that (b) matches real time. ref 06af88cd72ea fix #10452 --- test/functional/eval/reltime_spec.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/functional/eval/reltime_spec.lua b/test/functional/eval/reltime_spec.lua index ef7a3a148f..d78d858fb7 100644 --- a/test/functional/eval/reltime_spec.lua +++ b/test/functional/eval/reltime_spec.lua @@ -38,9 +38,13 @@ describe('reltimestr(), reltimefloat()', function() local older_time = reltime() command('sleep 1m') local newer_time = reltime() - -- Should be something like -0.002123. + + -- Start/end swapped: should be something like -0.002123. local rv = tonumber(reltimestr(reltime(newer_time, older_time))) - ok(rv < 0) - ok(rv > -10) + ok(rv < 0 and rv > -10) + + -- Not swapped: should be something like 0.002123. + rv = tonumber(reltimestr(reltime(older_time, newer_time))) + ok(rv > 0 and rv < 10) end) end) -- cgit