From b68d0f24cbb092c9dd4c8369c438a919f32451a9 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 17 Nov 2018 17:25:10 +0100 Subject: [PATCH] Library: settle long standing confusion regarding time border conditions basically we can pick just any convention here, and so we should pick the convention in a way that makes most sense informally, for a *human reader*. But what we previously did, was to pick the condition such as to make it simple in some situations for the programmer.... With the predictable result: even with the disappointingly small number of usages we have up to now, we got that condition backwards several times. OK, so from now on!!! Time::NEVER == Time::MAX, because "never" is as far as possible into the future --- src/lib/time/time.cpp | 4 ++-- src/steam/play/timings.cpp | 2 +- src/vault/engine/job.cpp | 2 +- tests/core/vault/engine/dummy-job.cpp | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/time/time.cpp b/src/lib/time/time.cpp index 9063f5d82..d01e7c56e 100644 --- a/src/lib/time/time.cpp +++ b/src/lib/time/time.cpp @@ -86,8 +86,8 @@ namespace time { const Time Time::MIN ( TimeValue::buildRaw_(-_raw(Time::MAX) ) ); const Time Time::ZERO; - const Time Time::ANYTIME(Time::MAX); - const Time Time::NEVER (Time::MIN); + const Time Time::ANYTIME(Time::MIN); + const Time Time::NEVER (Time::MAX); const Offset Offset::ZERO (Time::ZERO); diff --git a/src/steam/play/timings.cpp b/src/steam/play/timings.cpp index 93b029022..5ac4d5209 100644 --- a/src/steam/play/timings.cpp +++ b/src/steam/play/timings.cpp @@ -147,7 +147,7 @@ namespace play { Duration Timings::constantFrameTimingsInterval (TimeValue) const { - return Duration (Time::ANYTIME); + return Duration (Time::MAX); } diff --git a/src/vault/engine/job.cpp b/src/vault/engine/job.cpp index 61f97d609..13fa07275 100644 --- a/src/vault/engine/job.cpp +++ b/src/vault/engine/job.cpp @@ -107,7 +107,7 @@ namespace engine { Job::isValid() const { return this->jobClosure - && myClosure(this).verify (getNominalTime(), + and myClosure(this).verify (getNominalTime(), getInvocationInstanceID()); } diff --git a/tests/core/vault/engine/dummy-job.cpp b/tests/core/vault/engine/dummy-job.cpp index 061af4be1..d8b296f81 100644 --- a/tests/core/vault/engine/dummy-job.cpp +++ b/tests/core/vault/engine/dummy-job.cpp @@ -86,7 +86,7 @@ namespace engine { bool verify (Time nominalJobTime, InvocationInstanceID invoKey) const { - return Time::NEVER < nominalJobTime + return Time::ANYTIME < nominalJobTime && 0 <= invoKey.metaInfo.a && invoKey.metaInfo.a < MAX_PARAM_A && -MAX_PARAM_B <= invoKey.metaInfo.b @@ -116,8 +116,8 @@ namespace engine { { } Invocation() - : nominal(Time::NEVER) - , real(Time::ANYTIME) + : nominal(Time::ANYTIME) + , real(Time::NEVER) , a(MAX_PARAM_A), b(0) { } }; @@ -178,7 +178,7 @@ namespace engine { { REQUIRE (job.usesClosure (dummyClosure)); - return Time::NEVER != dummyClosure.queryInvocation(job.parameter).nominal; + return Time::NEVER != dummyClosure.queryInvocation(job.parameter).real; }