sparrow
2.4.0
C++20 idiomatic APIs for the Apache Arrow Columnar Format
Toggle main menu visibility
Loading...
Searching...
No Matches
timestamp_example.cpp
Go to the documentation of this file.
1
5
6
#include <cassert>
7
8
#include "
sparrow/timestamp_array.hpp
"
9
10
int
main
()
11
{
13
constexpr
uint64_t epoch = 1737639900;
// Thursday January 23, 2025 08:45:00
14
const
date::time_zone* new_york = date::locate_zone(
"America/New_York"
);
15
const
date::time_zone* paris = date::locate_zone(
"Europe/Paris"
);
16
std::vector<sparrow::timestamp<std::chrono::seconds>> input_values;
17
input_values.emplace_back(new_york, date::sys_time<std::chrono::seconds>{std::chrono::seconds(epoch)});
18
const
sparrow::timestamp_array<sparrow::timestamp<std::chrono::seconds>
> ar(paris, input_values);
19
assert(ar.size() == 1);
20
assert(ar[0].has_value());
21
assert(ar[0].value().get_sys_time().time_since_epoch().count() == epoch);
23
return
EXIT_SUCCESS;
24
}
main
int main()
Definition
builder_example.cpp:202
sparrow::timestamp_array
Array implementation for storing timestamp values with timezone information.
Definition
timestamp_array.hpp:209
timestamp_array.hpp
examples
timestamp_example.cpp
Generated by
1.17.0