File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -336,9 +336,24 @@ TEST(chrono_test, local_time) {
336336 fmt::format_error, " no timezone" );
337337}
338338
339+ template <typename T, FMT_ENABLE_IF(fmt::detail::has_member_data_tm_gmtoff<T>::value)>
340+ bool set_gmtoff (T& time, long offset) {
341+ time.tm_gmtoff = offset;
342+ return true ;
343+ }
344+ template <typename T, FMT_ENABLE_IF(!fmt::detail::has_member_data_tm_gmtoff<T>::value)>
345+ bool set_gmtoff (T&, long ) {
346+ return false ;
347+ }
348+
339349TEST (chrono_test, tm) {
340350 auto time = fmt::gmtime (290088000 );
341351 test_time (time);
352+ if (set_gmtoff (time, -28800 )) {
353+ EXPECT_EQ (fmt::format (fmt::runtime (" {:%z}" ), time), " -0800" );
354+ EXPECT_EQ (fmt::format (fmt::runtime (" {:%Ez}" ), time), " -08:00" );
355+ EXPECT_EQ (fmt::format (fmt::runtime (" {:%Oz}" ), time), " -08:00" );
356+ }
342357}
343358
344359TEST (chrono_test, daylight_savings_time_end) {
You can’t perform that action at this time.
0 commit comments