diff options
| author | Dan Engelbrecht <[email protected]> | 2025-04-02 20:35:53 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-04-02 20:35:53 +0200 |
| commit | f535a53cdda32b2b4950e32901dcd333bea82c23 (patch) | |
| tree | a50181e526db53cc609ac44defcea7609585fd31 /src/zencore/include | |
| parent | Merge branch 'main' of https://github.ol.epicgames.net/ue-foundation/zen (diff) | |
| download | zen-f535a53cdda32b2b4950e32901dcd333bea82c23.tar.xz zen-f535a53cdda32b2b4950e32901dcd333bea82c23.zip | |
use oidctoken executable to generate auth (#336)
- Feature: `zen builds` auth option `--oidctoken-exe-path` to let zen run the OidcToken executable to get and refresh authentication token
Diffstat (limited to 'src/zencore/include')
| -rw-r--r-- | src/zencore/include/zencore/fmtutils.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/fmtutils.h b/src/zencore/include/zencore/fmtutils.h index 8482157fb..10dfa5393 100644 --- a/src/zencore/include/zencore/fmtutils.h +++ b/src/zencore/include/zencore/fmtutils.h @@ -12,6 +12,7 @@ ZEN_THIRD_PARTY_INCLUDES_START #include <fmt/format.h> ZEN_THIRD_PARTY_INCLUDES_END +#include <chrono> #include <string_view> // Custom formatting for some zencore types @@ -102,3 +103,16 @@ struct fmt::formatter<T> : fmt::formatter<std::string_view> return fmt::formatter<std::string_view>::format(a.ToView(), ctx); } }; + +template<> +struct fmt::formatter<std::chrono::system_clock::time_point> : formatter<string_view> +{ + template<typename FormatContext> + auto format(const std::chrono::system_clock::time_point& TimePoint, FormatContext& ctx) const + { + std::time_t Time = std::chrono::system_clock::to_time_t(TimePoint); + char TimeString[std::size("yyyy-mm-ddThh:mm:ss")]; + std::strftime(std::data(TimeString), std::size(TimeString), "%FT%T", std::localtime(&Time)); + return fmt::format_to(ctx.out(), "{}", TimeString); + } +}; |