Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/absl/time/internal/get_current_time_posix.inc is written in an unsupported language. File is not indexed.

0001 #include "absl/time/clock.h"
0002 
0003 #include <sys/time.h>
0004 #include <ctime>
0005 #include <cstdint>
0006 
0007 #include "absl/base/internal/raw_logging.h"
0008 
0009 namespace absl {
0010 ABSL_NAMESPACE_BEGIN
0011 namespace time_internal {
0012 
0013 static int64_t GetCurrentTimeNanosFromSystem() {
0014   const int64_t kNanosPerSecond = 1000 * 1000 * 1000;
0015   struct timespec ts;
0016   ABSL_RAW_CHECK(clock_gettime(CLOCK_REALTIME, &ts) == 0,
0017                  "Failed to read real-time clock.");
0018   return (int64_t{ts.tv_sec} * kNanosPerSecond +
0019           int64_t{ts.tv_nsec});
0020 }
0021 
0022 }  // namespace time_internal
0023 ABSL_NAMESPACE_END
0024 }  // namespace absl