nullccxsy commented on code in PR #206:
URL: https://github.com/apache/iceberg-cpp/pull/206#discussion_r2320719311


##########
src/iceberg/expression/literal.cc:
##########
@@ -26,6 +26,16 @@
 
 namespace iceberg {
 
+namespace {
+
+constexpr int64_t kMicrosPerDay = 86400000000LL;  // 24 * 60 * 60 * 1000 * 1000
+
+int32_t MicrosToDays(int64_t micros) {
+  return static_cast<int32_t>(std::floor(static_cast<double>(micros) / 
kMicrosPerDay));

Review Comment:
   if (micros) < 0, we can use `static_cast<int32_t>((micros + kMicrosPerDay - 
1) / kMicrosPerDay))`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to