summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2024-04-08 12:50:42 +0200
committerChristian Göttsche <cgzones@googlemail.com>2024-04-08 12:50:42 +0200
commit0b0d50c50ebf4ea120440d2eb7d91dda11628898 (patch)
tree68d6b2fc2e2e710d164dd84ec376a7bfd76c0c21
parent599233ffdf1783011276145bd6933a1fd46fd932 (diff)
Row_printNanoseconds fixes
Don't print twice for 0.9s. Don't truncate on 1.2s, leading to an abort.
-rw-r--r--Row.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Row.c b/Row.c
index 66a4aa07..383257d9 100644
--- a/Row.c
+++ b/Row.c
@@ -425,13 +425,14 @@ void Row_printNanoseconds(RichString* str, unsigned long long totalNanoseconds,
if (totalMicroseconds < 1000000) {
len = xSnprintf(buffer, sizeof(buffer), ".%06lus ", (unsigned long)totalMicroseconds);
RichString_appendnAscii(str, baseColor, buffer, len);
+ return;
}
unsigned long long totalSeconds = totalMicroseconds / 1000000;
unsigned long microseconds = totalMicroseconds % 1000000;
if (totalSeconds < 60) {
int width = 5;
- unsigned long fraction = microseconds;
+ unsigned long fraction = microseconds / 10;
if (totalSeconds >= 10) {
width--;
fraction /= 10;

© 2014-2024 Faster IT GmbH | imprint | privacy policy