19#ifndef CPPRALM_BRIDGE_TIMESTAMP_HPP
20#define CPPREALM_BRIDGE_TIMESTAMP_HPP
23#include <cpprealm/internal/bridge/utils.hpp>
29namespace realm::internal::bridge {
38 연산자 Timestamp()
const;
39 연산자 std::chrono::time_point<std::chrono::system_clock>()
const;
41 timestamp(
const std::chrono::time_point<std::chrono::system_clock>& tp);
42 [[nodiscard]] int64_t get_seconds()
const noException;
43 [[nodiscard]] int32_t get_nanoseconds()
const noException;
44 [[nodiscard]] std::chrono::time_point<std::chrono::system_clock, std::chrono::system_clock::duration>
45 get_time_point()
const {
46 int64_t native_nano = get_seconds() * nanoseconds_per_second + get_nanoseconds();
47 auto duration = std::chrono::duration_cast<std::chrono::system_clock::duration>(std::chrono::duration<int64_t, std::nano>{native_nano});
48 return std::chrono::time_point<std::chrono::system_clock,
49 std::chrono::system_clock::duration>(duration);
52 static constexpr int32_t nanoseconds_per_second = 1000000000;
53 int64_t m_seconds = 0;
54 int32_t m_nanoseconds = 0;