|
|
|
|
@ -4,7 +4,7 @@ |
|
|
|
|
|
|
|
|
|
#include <string_view> |
|
|
|
|
#include <string> |
|
|
|
|
#include <cstdio> |
|
|
|
|
#include <format> |
|
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
|
|
namespace monoformat { |
|
|
|
|
@ -1029,19 +1029,17 @@ std::expected<void, ParseError> handleCurrentTime(std::span<std::byte const>& bu |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
char text[32] = {}; |
|
|
|
|
std::string text; |
|
|
|
|
if (showHours && showMinutes && showSeconds) { |
|
|
|
|
std::snprintf(text, sizeof(text), "%02d:%02d:%02d", int(hours), int(minutes), int(seconds)); |
|
|
|
|
text = std::format("{:02d}:{:02d}:{:02d}", hours, minutes, seconds); |
|
|
|
|
} else if (showHours && showMinutes) { |
|
|
|
|
std::snprintf(text, sizeof(text), "%02d:%02d", int(hours), int(minutes)); |
|
|
|
|
text = std::format("{:02d}:{:02d}", hours, minutes); |
|
|
|
|
} else if (showHours) { |
|
|
|
|
std::snprintf(text, sizeof(text), "%02d", int(hours)); |
|
|
|
|
text = std::format("{:02d}", hours); |
|
|
|
|
} else if (showMinutes && showSeconds) { |
|
|
|
|
std::snprintf(text, sizeof(text), "%02d:%02d", int(minutes), int(seconds)); |
|
|
|
|
text = std::format("{:02d}:{:02d}", minutes, seconds); |
|
|
|
|
} else if (showSeconds) { |
|
|
|
|
std::snprintf(text, sizeof(text), "%02d", int(seconds)); |
|
|
|
|
} else if (showMinutes) { |
|
|
|
|
std::snprintf(text, sizeof(text), "%02d", int(minutes)); |
|
|
|
|
text = std::format("{:02d}", seconds); |
|
|
|
|
} else { |
|
|
|
|
return {}; |
|
|
|
|
} |
|
|
|
|
|