25#include "iceberg/util/temporal_util.h"
29using namespace std::chrono;
41 int32_t microsecond{0};
51 int32_t microsecond{0};
53 int32_t tz_offset_minutes{0};
63 int32_t nanosecond{0};
65 int32_t tz_offset_minutes{0};
72 return static_cast<int32_t
>(
73 (sys_days(year{parts.year} / month{parts.month} / day{parts.day}) -
80 return duration_cast<microseconds>(hours(parts.hour) + minutes(parts.minute) +
81 seconds(parts.second) +
82 microseconds(parts.microsecond))
88 year_month_day ymd{year{parts.year}, month{parts.month}, day{parts.day}};
89 auto tp = sys_time<microseconds>{(sys_days(ymd) + hours{parts.hour} +
90 minutes{parts.minute} + seconds{parts.second} +
91 microseconds{parts.microsecond})
93 return tp.time_since_epoch().count();
98 year_month_day ymd{year{parts.year}, month{parts.month}, day{parts.day}};
99 auto tp = sys_time<microseconds>{(sys_days(ymd) + hours{parts.hour} +
100 minutes{parts.minute} + seconds{parts.second} +
101 microseconds{parts.microsecond} -
102 minutes{parts.tz_offset_minutes})
103 .time_since_epoch()};
104 return tp.time_since_epoch().count();
109 year_month_day ymd{year{parts.year}, month{parts.month}, day{parts.day}};
111 sys_time<nanoseconds>{(sys_days(ymd) + hours{parts.hour} + minutes{parts.minute} +
112 seconds{parts.second} + nanoseconds{parts.nanosecond})
113 .time_since_epoch()};
114 return tp.time_since_epoch().count();
119 year_month_day ymd{year{parts.year}, month{parts.month}, day{parts.day}};
121 sys_time<nanoseconds>{(sys_days(ymd) + hours{parts.hour} + minutes{parts.minute} +
122 seconds{parts.second} + nanoseconds{parts.nanosecond} -
123 minutes{parts.tz_offset_minutes})
124 .time_since_epoch()};
125 return tp.time_since_epoch().count();
Definition temporal_test_helper.h:68
static int64_t CreateTimestamp(const TimestampParts &parts)
Construct a timestamp, microsecond precision, without timezone.
Definition temporal_test_helper.h:87
static int64_t CreateTimestampNanos(const TimestampNanosParts &parts)
Construct a timestamp, nanosecond precision, without timezone.
Definition temporal_test_helper.h:108
static int64_t CreateTimestampTz(const TimestampParts &parts)
Construct a timestamp, microsecond precision, with timezone.
Definition temporal_test_helper.h:97
static int64_t CreateTime(const TimeParts &parts)
Construct a time-of-day, microsecond precision, without date, timezone.
Definition temporal_test_helper.h:79
static int32_t CreateDate(const DateParts &parts)
Construct a Calendar date without timezone or time.
Definition temporal_test_helper.h:71
static int64_t CreateTimestampTzNanos(const TimestampNanosParts &parts)
Construct a timestamp, nanosecond precision, with timezone.
Definition temporal_test_helper.h:118
Definition temporal_test_helper.h:31
Definition temporal_test_helper.h:37
Definition temporal_test_helper.h:56
Definition temporal_test_helper.h:44