Skip to content

Conversation

@LukashonakV
Copy link

Hi @vitaut , this PR provides zoned_time formatter.


#include <fmt/chrono.h>  
#include <spdlog/spdlog.h>  

using namespace std::chrono;  

int main(int argc, char* argv[]) {
  const std::chrono::zoned_time now{locate_zone("America/Chicago"),
                       floor<seconds>(system_clock::now())};
  std::string fmt_result{fmt::format("{:%H:%M %Z %z}", now)};
  std::string std_result{std::format("{:%H:%M %Z %z}", now)};

  spdlog::info("\nfmt_result: {}\nstd_result: {}", fmt_result, std_result);
  return 0;
}

With the result:

[2026-01-09 02:09:56.643] [info] 
fmt_result: 17:09 CST -0600
std_result: 17:09 CST -0600

@LukashonakV LukashonakV force-pushed the zoned_time branch 2 times, most recently from 8fb59ec to a577b1c Compare January 8, 2026 23:29
Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatter should be conditionally defined since zoned_time is a C++20 feature.

@LukashonakV
Copy link
Author

Hi @vitaut , yes I've checked CI logs and is trying to solve it

@LukashonakV LukashonakV force-pushed the zoned_time branch 4 times, most recently from 2a9839b to e10e922 Compare January 9, 2026 22:52
@LukashonakV LukashonakV force-pushed the zoned_time branch 2 times, most recently from 6787974 to 94381c8 Compare January 9, 2026 23:16
@LukashonakV
Copy link
Author

Now it should be fine.

@LukashonakV
Copy link
Author

Hi @vitaut , can you please review once again, when you have a time of course. Thanks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants