Antropovi commented on code in PR #47017:
URL: https://github.com/apache/arrow/pull/47017#discussion_r2231022941


##########
cpp/src/arrow/flight/sql/odbc/odbcabstraction/calendar_utils.cc:
##########
@@ -39,13 +41,30 @@ int64_t GetTodayTimeFromEpoch() {
 #endif
 }
 
-void GetTimeForSecondsSinceEpoch(tm& date, int64_t value) {
-#if defined(_WIN32)
-  gmtime_s(&date, &value);
-#else
-  time_t time_value = static_cast<time_t>(value);
-  gmtime_r(&time_value, &date);
-#endif
+void GetTimeForSecondsSinceEpoch(std::tm& out_tm, int64_t seconds_since_epoch) 
{
+  try {
+    std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> 
timepoint{
+        std::chrono::seconds{seconds_since_epoch}};
+
+    std::chrono::year_month_day ymd = 
std::chrono::floor<std::chrono::days>(timepoint);
+
+    std::chrono::hh_mm_ss<std::chrono::seconds> timeofday{
+        timepoint - std::chrono::floor<std::chrono::days>(timepoint)};

Review Comment:
   Because hh_mm_ss class needs sys_clock passed to constructor, but not 
year_month_day type. I made temporary variable in new commit for more 
clearance. What do you think?



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to