palak-9202 commented on code in PR #13428:
URL: https://github.com/apache/arrow/pull/13428#discussion_r914448375


##########
cpp/src/gandiva/gdv_function_stubs.cc:
##########
@@ -611,6 +611,47 @@ int32_t gdv_fn_cast_intervalyear_utf8_int32(int64_t 
context_ptr, int64_t holder_
   auto* holder = reinterpret_cast<gandiva::IntervalYearsHolder*>(holder_ptr);
   return (*holder)(context, data, data_len, in1_validity, out_valid);
 }
+
+GANDIVA_EXPORT
+gdv_timestamp to_utc_timezone_timestamp(int64_t context, gdv_timestamp 
time_miliseconds,
+                                        const char* timezone, gdv_int32 
length) {
+  using arrow_vendored::date::time_zone;
+
+  arrow_vendored::date::sys_time <std::chrono::milliseconds> tp
+                                  
{std::chrono::milliseconds{time_miliseconds}};
+  try {
+    const time_zone* local_tz = arrow_vendored::date::locate_zone
+                                (std::string(timezone, length));
+    gdv_timestamp offset = local_tz->get_info(tp).offset.count()*1000;
+    return time_miliseconds - static_cast<gdv_timestamp>(offset);
+  } catch(...) {
+      gdv_fn_context_set_error_msg(context, "Invalid time zone");

Review Comment:
   Try:
   for(auto const& z : get_tzdb().zones) {
       cout<<z.name()<<'\n';
     }



-- 
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]

Reply via email to