Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/utils/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ inline std::string ascTime(const time_t *t) {
struct tm timeinfo;
localtime_r(t, &timeinfo);
char tstr[std::size("Www Mmm dd hh:mm:ss yyyy")];
strftime(tstr, std::size(tstr), "%c", &timeinfo);
// `%c` is equivalent to `%a %b %e %T %Y` with a fixed length, even though zero-padded
// month of day is optional, depending on the locale. This would lead to an empty space, e.g.,
// `Sat Jun 7 11:46:23 2025` (notice the two spaces before the day of month).
// Use `%d` instead and enforce padding.
strftime(tstr, std::size(tstr), "%a %b %d %T %Y", &timeinfo);
return tstr;
}

Expand Down
Loading