// file : libbuild2/script/timeout.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file #include #include #include using namespace std; namespace build2 { optional parse_timeout (const string& s, const char* what, const char* prefix, const location& l) { if (optional n = parse_number (s)) { return *n != 0 ? chrono::duration_cast (chrono::seconds (*n)) : optional (); } else fail (l) << prefix << "invalid " << what << " '" << s << "'" << endf; } }