Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc / deps / grpc / third_party / abseil-cpp / absl / time / internal / get_current_time_posix.inc
diff --git a/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc b/legacy-libs/grpc/deps/grpc/third_party/abseil-cpp/absl/time/internal/get_current_time_posix.inc
new file mode 100644 (file)
index 0000000..65474ca
--- /dev/null
@@ -0,0 +1,22 @@
+#include "absl/time/clock.h"
+
+#include <sys/time.h>
+#include <ctime>
+#include <cstdint>
+
+#include "absl/base/internal/raw_logging.h"
+
+namespace absl {
+namespace time_internal {
+
+static int64_t GetCurrentTimeNanosFromSystem() {
+  const int64_t kNanosPerSecond = 1000 * 1000 * 1000;
+  struct timespec ts;
+  ABSL_RAW_CHECK(clock_gettime(CLOCK_REALTIME, &ts) == 0,
+                 "Failed to read real-time clock.");
+  return (int64_t{ts.tv_sec} * kNanosPerSecond +
+          int64_t{ts.tv_nsec});
+}
+
+}  // namespace time_internal
+}  // namespace absl