diff --git a/src/utils/string.h b/src/utils/string.h index ca2967aa5f..7ef5d04892 100644 --- a/src/utils/string.h +++ b/src/utils/string.h @@ -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; }