diff options
Diffstat (limited to 'libbuild2/script/script.ixx')
-rw-r--r-- | libbuild2/script/script.ixx | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/libbuild2/script/script.ixx b/libbuild2/script/script.ixx index 56043b2..37c77ec 100644 --- a/libbuild2/script/script.ixx +++ b/libbuild2/script/script.ixx @@ -25,7 +25,6 @@ namespace build2 inline command_to_stream operator| (command_to_stream x, command_to_stream y) {return x |= y;} - // command // inline ostream& @@ -52,5 +51,39 @@ namespace build2 to_stream (o, e, command_to_stream::all); return o; } + + // deadline + // + inline bool + operator< (const deadline& x, const deadline& y) + { + if (x.value != y.value) + return x.value < y.value; + + return x.success < y.success; + } + + inline optional<deadline> + to_deadline (const optional<timestamp>& ts, bool success) + { + return ts ? deadline (*ts, success) : optional<deadline> (); + } + + // timeout + // + inline bool + operator< (const timeout& x, const timeout& y) + { + if (x.value != y.value) + return x.value < y.value; + + return x.success < y.success; + } + + inline optional<timeout> + to_timeout (const optional<duration>& d, bool success) + { + return d ? timeout (*d, success) : optional<timeout> (); + } } } |