// file : libbuild2/script/timeout.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file namespace build2 { inline optional parse_deadline (const string& s, const char* what, const char* prefix, const location& l) { if (optional t = parse_timeout (s, what, prefix, l)) return system_clock::now () + *t; else return nullopt; } template inline T earlier (const T& x, const T& y) { return x < y ? x : y; } template inline T earlier (const T& x, const optional& y) { return y ? earlier (x, *y) : x; } template inline T earlier (const optional& x, const T& y) { return earlier (y, x); } template inline optional earlier (const optional& x, const optional& y) { return x ? earlier (*x, y) : y ? earlier (*y, x) : optional (); } }