MCPcopy Create free account
hub / github.com/apache/impala / Subtract

Method Subtract

be/src/runtime/timestamp-value.cc:296–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296TimestampValue TimestampValue::Subtract(const boost::posix_time::time_duration& t) const {
297 if (!IsValidTime(t) || !HasDateAndTime()) return TimestampValue();
298
299 int64_t this_in_nano_sec = time_.total_nanoseconds();
300 int64_t t_in_nano_sec = t.total_nanoseconds();
301 if (this_in_nano_sec - t_in_nano_sec >= 0) {
302 return TimestampValue(date_, time_ - t);
303 } else {
304 return TimestampValue(date_ - boost::gregorian::date_duration(1),
305 boost::posix_time::time_duration(
306 0, 0, 0, NANOS_PER_DAY + this_in_nano_sec - t_in_nano_sec));
307 }
308}
309}

Callers 4

CheckOverlapForTimestampFunction · 0.45
TESTFunction · 0.45
InsertForLTMethod · 0.45

Calls 2

time_durationClass · 0.85
TimestampValueClass · 0.70

Tested by 2

CheckOverlapForTimestampFunction · 0.36
TESTFunction · 0.36