summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-06-07 11:54:55 -0400
committerAndrew Opalach <andrew@akon.city> 2025-06-07 11:54:55 -0400
commite9475ce94ba69bd437d8cf0cf3f78062be928568 (patch)
tree63efef03577f8471b904295fc6878d7d960c00aa /src/util
parent1e53cb62651b62ad7c03cbeb64e76546e8978ff7 (diff)
downloadcamu-e9475ce94ba69bd437d8cf0cf3f78062be928568.tar.gz
camu-e9475ce94ba69bd437d8cf0cf3f78062be928568.tar.bz2
camu-e9475ce94ba69bd437d8cf0cf3f78062be928568.zip
Clarify and fix various sink behaviors
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/print_time.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/util/print_time.h b/src/util/print_time.h
index d9dd4cc..89644b2 100644
--- a/src/util/print_time.h
+++ b/src/util/print_time.h
@@ -11,10 +11,9 @@ static inline s32 camu_print_time(char *buf, size_t size, u64 nanoseconds, bool
seconds -= minutes * 60u;
minutes -= hours * 60u;
s32 offset = 0;
- if (show_hour) {
+ if (show_hour && hour_padding >= 2 && hour_padding <= 4) {
static const char *padding_table[] = { "%.2u:", "%.3u:", "%.4u:" };
- hour_padding = CLAMP(hour_padding, 2u, 4u) - 2u;
- offset += al_snprintf(buf, size, padding_table[hour_padding], hours);
+ offset += al_snprintf(buf, size, padding_table[hour_padding - 2u], hours);
}
offset += al_snprintf(buf + offset, size - offset, "%.2u:%.2u", minutes, seconds);
return offset;