From e4f4fee6d49355dbb07965cc3d70d36a8c7ecc8b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 10 Feb 2019 01:02:57 +0100 Subject: [PATCH] Optimize printing days. --- server/TracyView.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1d42e6d8..e6a4292e 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -225,7 +225,15 @@ static const char* TimeToString( int64_t _ns ) const auto h = int64_t( ns / ( 1000ll * 1000 * 1000 * 60 * 60 ) - d * 24 ); const auto m = int64_t( ns / ( 1000ll * 1000 * 1000 * 60 ) - d * ( 60 * 24 ) - h * 60 ); const auto s = int64_t( ns / ( 1000ll * 1000 * 1000 ) - d * ( 60 * 60 * 24 ) - h * ( 60 * 60 ) - m * 60 ); - buf += sprintf( buf, "%" PRIi64 "d", d ); + if( d < 1000 ) + { + PrintSmallInt( buf, d ); + *buf++ = 'd'; + } + else + { + buf += sprintf( buf, "%" PRIi64 "d", d ); + } PrintTinyInt0( buf, h ); *buf++ = ':'; PrintTinyInt0( buf, m );