palak-9202 commented on code in PR #13428: URL: https://github.com/apache/arrow/pull/13428#discussion_r918607114
########## cpp/src/gandiva/gdv_function_stubs_test.cc: ########## @@ -993,4 +993,57 @@ TEST(TestGdvFnStubs, TestTranslate) { EXPECT_EQ(expected, std::string(result, out_len)); } +TEST(TestTime, TestToUtcTimezone) { + ExecutionContext context; + auto context_ptr = reinterpret_cast<int64_t>(&context); + gdv_int32 len_ist = static_cast<gdv_int32>(strlen("Asia/Kolkata")); + gdv_int32 len_pst = static_cast<gdv_int32>(strlen("America/Los_Angeles")); + + //2012-02-28 15:30:00 Asia/Kolkata + gdv_timestamp ts = 55800000; + gdv_timestamp ts2 = to_utc_timezone_timestamp(context_ptr, ts, + "Asia/Kolkata", len_ist); + EXPECT_EQ(36000000, ts2); + + //1970-01-01 5:00:00 Asia/Kolkata + ts = 18000000; + ts2 = to_utc_timezone_timestamp(context_ptr, ts, "Asia/Kolkata", len_ist); + EXPECT_EQ(ts2, -1800000); + + //daylight savings check + //2018-03-11 01:00:00 America/Los_Angeles + ts = 1520730000000; + ts2 = to_utc_timezone_timestamp(context_ptr, ts, "America/Los_Angeles", len_pst); + EXPECT_EQ(ts2, 1520758800000); + + //2018-03-12 01:00:00 America/Los_Angeles + ts = 1331712000000; + ts2 = to_utc_timezone_timestamp(context_ptr, ts, "America/Los_Angeles", len_pst); + EXPECT_EQ(ts2, 1331737200000); Review Comment: I've added a failure test and modified the error message to include the time zone name given as input -- 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