aboutsummaryrefslogtreecommitdiff
path: root/libbutl/timestamp.mxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-09-04 16:15:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-09-04 16:15:39 +0200
commiteaf13f53eeaba8f6ffe5f2e38ff51eefd273046d (patch)
treee1ebaa2c4695cc76b4e0cc5bd8433dde6cebecda /libbutl/timestamp.mxx
parentf827ab10652dd7e6caa6e600821e15b0f461b52c (diff)
Add timestamp_unreal special value
Diffstat (limited to 'libbutl/timestamp.mxx')
-rw-r--r--libbutl/timestamp.mxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/libbutl/timestamp.mxx b/libbutl/timestamp.mxx
index af44680..76c7978 100644
--- a/libbutl/timestamp.mxx
+++ b/libbutl/timestamp.mxx
@@ -56,19 +56,26 @@ LIBBUTL_MODEXPORT namespace butl
using timestamp = system_clock::time_point;
using duration = system_clock::duration;
- // Generally-useful special values. Note that unknown is less than
- // nonexistent and is less than any non-special value.
+ // Generally-useful special values.
+ //
+ // Note that unknown is less than nonexistent which in turn is less than
+ // unreal and all of them are less than any non-special value (strictly
+ // speaking unreal is no greater (older) than any real value).
//
#if defined(__cpp_modules) && defined(__clang__) //@@ MOD Clang duplicate sym.
inline const timestamp::rep timestamp_unknown_rep = -1;
inline const timestamp timestamp_unknown = timestamp (duration (-1));
inline const timestamp::rep timestamp_nonexistent_rep = 0;
inline const timestamp timestamp_nonexistent = timestamp (duration (0));
+ inline const timestamp::rep timestamp_unreal_rep = 1;
+ inline const timestamp timestamp_unreal = timestamp (duration (1));
#else
const timestamp::rep timestamp_unknown_rep = -1;
const timestamp timestamp_unknown = timestamp (duration (-1));
const timestamp::rep timestamp_nonexistent_rep = 0;
const timestamp timestamp_nonexistent = timestamp (duration (0));
+ const timestamp::rep timestamp_unreal_rep = 1;
+ const timestamp timestamp_unreal = timestamp (duration (1));
#endif
// Print human-readable representation of the timestamp.
@@ -86,8 +93,8 @@ LIBBUTL_MODEXPORT namespace butl
// part is padded to 9 characters with leading zeros.
//
// The special argument in the to_stream() function indicates whether the
- // special timestamp_unknown and timestamp_nonexistent values should be
- // printed as '<unknown>' and '<nonexistent>', respectively.
+ // special timestamp_{unknown,nonexistent,unreal} values should be printed
+ // as '<unknown>', '<nonexistent>', and '<unreal>', respectively.
//
// The local argument in the to_stream() function indicates whether to use
// localtime_r() or gmtime_r().