MCPcopy Create free account
hub / github.com/apache/arrow / ConvertTimestampValue

Function ConvertTimestampValue

cpp/src/arrow/util/time.cc:47–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47Result<int64_t> ConvertTimestampValue(const std::shared_ptr<DataType>& in,
48 const std::shared_ptr<DataType>& out,
49 int64_t value) {
50 auto op_factor =
51 GetTimestampConversion(checked_cast<const TimestampType&>(*in).unit(),
52 checked_cast<const TimestampType&>(*out).unit());
53
54 auto op = op_factor.first;
55 auto factor = op_factor.second;
56 switch (op) {
57 case MULTIPLY:
58 return value * factor;
59 case DIVIDE:
60 return value / factor;
61 }
62
63 // unreachable...
64 return 0;
65}
66
67} // namespace util
68} // namespace arrow

Callers 1

TESTFunction · 0.85

Calls 2

GetTimestampConversionFunction · 0.85
unitMethod · 0.45

Tested by 1

TESTFunction · 0.68