26#include "iceberg/iceberg_export.h"
27#include "iceberg/result.h"
30namespace iceberg::internal {
32inline constexpr int64_t kNanosPerMicro = 1000;
33inline constexpr int64_t kMicrosPerMilli = 1000;
34inline constexpr int64_t kMicrosPerSecond = 1000 * kMicrosPerMilli;
35inline constexpr int64_t kSecondsPerMinute = 60;
36inline constexpr int64_t kMinutesPerHour = 60;
37inline constexpr int64_t kHoursPerDay = 24;
38inline constexpr int64_t kSecondsPerHour = kMinutesPerHour * kSecondsPerMinute;
39inline constexpr int64_t kSecondsPerDay = kHoursPerDay * kSecondsPerHour;
40inline constexpr int64_t kMicrosPerDay = kSecondsPerDay * kMicrosPerSecond;
41inline constexpr int64_t kNanosPerMilli = kMicrosPerMilli * kNanosPerMicro;
42inline constexpr int64_t kNanosPerSecond = kMicrosPerSecond * kNanosPerMicro;
43inline constexpr int64_t kNanosPerDay = kMicrosPerDay * kNanosPerMicro;
45inline constexpr auto kEpochYmd = std::chrono::year{1970} / std::chrono::January / 1;
46inline constexpr auto kEpochDays = std::chrono::sys_days{kEpochYmd};
55 static int64_t NanosToMicros(int64_t nanos);
58 static Result<int64_t> MicrosToNanos(int64_t micros);
66 static Result<int32_t> ParseDay(std::string_view str);
76 static Result<int64_t> ParseTime(std::string_view str);
86 static Result<int64_t> ParseTimeNs(std::string_view str);
96 static Result<int64_t> ParseTimestamp(std::string_view str);
106 static Result<int64_t> ParseTimestampNs(std::string_view str);
116 static Result<int64_t> ParseTimestampWithZone(std::string_view str);
126 static Result<int64_t> ParseTimestampNsWithZone(std::string_view str);
142 static Result<bool> IsUtcOffset(std::string_view str);
145 static Result<Literal> ExtractYear(
const Literal& literal);
148 static Result<Literal> ExtractMonth(
const Literal& literal);
151 static Result<Literal> ExtractDay(
const Literal& literal);
154 static Result<Literal> ExtractHour(
const Literal& literal);
Literal is a literal value that is associated with a primitive type.
Definition literal.h:39
Definition temporal_util.h:52