27using namespace std::chrono;
39 int32_t microsecond{0};
49 int32_t microsecond{0};
51 int32_t tz_offset_minutes{0};
61 int32_t nanosecond{0};
63 int32_t tz_offset_minutes{0};
67 static constexpr auto kEpochDays = sys_days(year{1970} / January / 1);
72 return static_cast<int32_t
>(
73 (sys_days(year{parts.year} / month{parts.month} / day{parts.day}) - kEpochDays)
79 return duration_cast<microseconds>(hours(parts.hour) + minutes(parts.minute) +
80 seconds(parts.second) +
81 microseconds(parts.microsecond))
87 year_month_day ymd{year{parts.year}, month{parts.month}, day{parts.day}};
88 auto tp = sys_time<microseconds>{(sys_days(ymd) + hours{parts.hour} +
89 minutes{parts.minute} + seconds{parts.second} +
90 microseconds{parts.microsecond})
92 return tp.time_since_epoch().count();
97 year_month_day ymd{year{parts.year}, month{parts.month}, day{parts.day}};
98 auto tp = sys_time<microseconds>{(sys_days(ymd) + hours{parts.hour} +
99 minutes{parts.minute} + seconds{parts.second} +
100 microseconds{parts.microsecond} -
101 minutes{parts.tz_offset_minutes})
102 .time_since_epoch()};
103 return tp.time_since_epoch().count();
108 year_month_day ymd{year{parts.year}, month{parts.month}, day{parts.day}};
110 sys_time<nanoseconds>{(sys_days(ymd) + hours{parts.hour} + minutes{parts.minute} +
111 seconds{parts.second} + nanoseconds{parts.nanosecond})
112 .time_since_epoch()};
113 return tp.time_since_epoch().count();
118 year_month_day ymd{year{parts.year}, month{parts.month}, day{parts.day}};
120 sys_time<nanoseconds>{(sys_days(ymd) + hours{parts.hour} + minutes{parts.minute} +
121 seconds{parts.second} + nanoseconds{parts.nanosecond} -
122 minutes{parts.tz_offset_minutes})
123 .time_since_epoch()};
124 return tp.time_since_epoch().count();
Definition temporal_test_helper.h:66
static int64_t CreateTimestamp(const TimestampParts &parts)
Construct a timestamp, microsecond precision, without timezone.
Definition temporal_test_helper.h:86
static int64_t CreateTimestampNanos(const TimestampNanosParts &parts)
Construct a timestamp, nanosecond precision, without timezone.
Definition temporal_test_helper.h:107
static int64_t CreateTimestampTz(const TimestampParts &parts)
Construct a timestamp, microsecond precision, with timezone.
Definition temporal_test_helper.h:96
static int64_t CreateTime(const TimeParts &parts)
Construct a time-of-day, microsecond precision, without date, timezone.
Definition temporal_test_helper.h:78
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:117
Definition temporal_test_helper.h:29
Definition temporal_test_helper.h:35
Definition temporal_test_helper.h:54
Definition temporal_test_helper.h:42