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

Function trunc

cpp/src/arrow/util/chrono_internal.h:137–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135// trunc (truncation toward zero) is not in std::chrono, only floor/ceil/round
136template <typename ToDuration, typename Rep, typename Period>
137constexpr ToDuration trunc(const std::chrono::duration<Rep, Period>& d) {
138 auto floored = std::chrono::floor<ToDuration>(d);
139 // floor rounds toward -infinity; for negative values with remainder, add 1 to get
140 // toward zero
141 if (d.count() < 0 && (d - floored).count() != 0) {
142 return floored + ToDuration{1};
143 }
144 return floored;
145}
146
147// Timezone lookup
148inline const time_zone* locate_zone(std::string_view tz_name) {

Callers 1

RoundMethod · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected