From c0b3161d3c934ef78ad6ce864dce59f8274baf98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wei=C3=9F?= Date: Thu, 6 May 2021 16:45:53 +0200 Subject: [PATCH] Improve SecondsFormatter format strings. --- Formatters/SecondsFormatter.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Formatters/SecondsFormatter.m b/Formatters/SecondsFormatter.m index 03f2fdf4d..a1de1308a 100644 --- a/Formatters/SecondsFormatter.m +++ b/Formatters/SecondsFormatter.m @@ -63,16 +63,16 @@ const char *signPrefix = isNegative ? "-" : ""; if (0 < days) { - result = [NSString stringWithFormat:@"%s%i:%.2i:%.2i:%.2i", signPrefix, days, hours, minutes, seconds]; + result = [NSString stringWithFormat:@"%s" "%" PRIi32 ":" "%02" PRIi32 ":" "%02" PRIi32 ":" "%02" PRIi32 "", signPrefix, days, hours, minutes, seconds]; } else if (0 < hours) { - result = [NSString stringWithFormat:@"%s%i:%.2i:%.2i", signPrefix, hours, minutes, seconds]; + result = [NSString stringWithFormat:@"%s" "%" PRIi32 ":" "%02" PRIi32 ":" "%02" PRIi32 "", signPrefix, hours, minutes, seconds]; } else if (0 < minutes) { - result = [NSString stringWithFormat:@"%s%i:%.2i", signPrefix, minutes, seconds]; + result = [NSString stringWithFormat:@"%s" "%" PRIi32 ":" "%02" PRIi32 "", signPrefix, minutes, seconds]; } else { - result = [NSString stringWithFormat:@"%s0:%.2i", signPrefix, seconds]; + result = [NSString stringWithFormat:@"%s" "0:" "%02" PRIi32 "", signPrefix, seconds]; } return result;