@@ -375,16 +375,12 @@ TEST(chrono_test, local_time) {
375
375
#endif
376
376
specs.push_back (" %Y-%m-%d %H:%M:%S" );
377
377
378
- #if FMT_USE_LOCAL_TIME
379
378
# ifdef _WIN32
380
379
return ; // Not supported on Windows.
381
380
# endif
382
381
383
382
for (const auto & spec : specs) {
384
- auto sys_time = std::chrono::system_clock::to_time_t (
385
- std::chrono::current_zone ()->to_sys (t));
386
- auto tm = *std::localtime (&sys_time);
387
-
383
+ auto tm = fmt::gmtime (t.time_since_epoch ().count ());
388
384
auto sys_output = system_strftime (spec, &tm );
389
385
390
386
auto fmt_spec = fmt::format (" {{:{}}}" , spec);
@@ -393,10 +389,7 @@ TEST(chrono_test, local_time) {
393
389
}
394
390
395
391
if (std::find (specs.cbegin (), specs.cend (), " %z" ) != specs.cend ()) {
396
- auto sys_time = std::chrono::system_clock::to_time_t (
397
- std::chrono::current_zone ()->to_sys (t));
398
- auto tm = *std::localtime (&sys_time);
399
-
392
+ auto tm = fmt::gmtime (t.time_since_epoch ().count ());
400
393
auto sys_output = system_strftime (" %z" , &tm );
401
394
sys_output.insert (sys_output.end () - 2 , 1 , ' :' );
402
395
@@ -406,7 +399,6 @@ TEST(chrono_test, local_time) {
406
399
EXPECT_EQ (sys_output, fmt::format (" {:%Oz}" , t));
407
400
EXPECT_EQ (sys_output, fmt::format (" {:%Oz}" , tm ));
408
401
}
409
- #endif // FMT_USE_LOCAL_TIME
410
402
}
411
403
412
404
TEST (chrono_test, daylight_savings_time_end) {
0 commit comments