13 #ifndef LLVM_LIB_SUPPORT_UNIX_UNIX_H 14 #define LLVM_LIB_SUPPORT_UNIX_UNIX_H 21 #include "llvm/Config/config.h" 32 #include <sys/types.h> 39 #ifdef HAVE_SYS_PARAM_H 40 #include <sys/param.h> 43 #ifdef HAVE_SYS_TIME_H 44 # include <sys/time.h> 64 std::string* ErrMsg,
const std::string& prefix,
int errnum = -1) {
86 inline std::chrono::microseconds
toDuration(
const struct timeval &TV) {
87 return std::chrono::seconds(TV.tv_sec) +
88 std::chrono::microseconds(TV.tv_usec);
95 struct timespec RetVal;
97 RetVal.tv_nsec = (TP.time_since_epoch() % seconds(1)).
count();
105 struct timeval RetVal;
107 RetVal.tv_usec = (TP.time_since_epoch() % seconds(1)).
count();
This class represents lattice values for constants.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
struct timespec toTimeSpec(TimePoint<> TP)
Convert a time point to struct timespec.
std::string StrError()
Returns a string representation of the errno value, using whatever thread-safe variant of strerror() ...
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
std::time_t toTimeT(TimePoint<> TP)
Convert a TimePoint to std::time_t.
struct timeval toTimeVal(TimePoint< std::chrono::microseconds > TP)
Convert a time point to struct timeval.
#define LLVM_ATTRIBUTE_NORETURN
static LLVM_ATTRIBUTE_NORETURN void ReportErrnumFatal(const char *Msg, int errnum)
std::chrono::nanoseconds toDuration(FILETIME Time)
static bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix, int errnum=-1)
This function builds an error message into ErrMsg using the prefix string and the Unix error number g...
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.