mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Add hours to time-to-string conversion.
This commit is contained in:
parent
7b07b67d89
commit
ade97b7ab6
@ -54,12 +54,19 @@ static const char* TimeToString( int64_t ns )
|
|||||||
{
|
{
|
||||||
sprintf( buf, "%s%.2f s", sign, ns / ( 1000. * 1000. * 1000. ) );
|
sprintf( buf, "%s%.2f s", sign, ns / ( 1000. * 1000. * 1000. ) );
|
||||||
}
|
}
|
||||||
else
|
else if( ns < 1000ll * 1000 * 1000 * 60 * 60 )
|
||||||
{
|
{
|
||||||
const auto m = int64_t( ns / ( 1000ll * 1000 * 1000 * 60 ) );
|
const auto m = int64_t( ns / ( 1000ll * 1000 * 1000 * 60 ) );
|
||||||
const auto s = int64_t( ns - m * ( 1000ll * 1000 * 1000 * 60 ) );
|
const auto s = int64_t( ns - m * ( 1000ll * 1000 * 1000 * 60 ) );
|
||||||
sprintf( buf, "%s%" PRIi64 ":%04.1f", sign, m, s / ( 1000. * 1000. * 1000. ) );
|
sprintf( buf, "%s%" PRIi64 ":%04.1f", sign, m, s / ( 1000. * 1000. * 1000. ) );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto h = int64_t( ns / ( 1000ll * 1000 * 1000 * 60 * 60 ) );
|
||||||
|
const auto m = int64_t( ns / ( 1000ll * 1000 * 1000 * 60 ) - h * 60 );
|
||||||
|
const auto s = int64_t( ns - h * ( 1000ll * 1000 * 1000 * 60 * 60 ) - m * ( 1000ll * 1000 * 1000 * 60 ) );
|
||||||
|
sprintf( buf, "%s%" PRIi64 ":%02" PRIi64 ":%02" PRIi64, sign, h, m, int64_t( s / ( 1000ll * 1000 * 1000 ) ) );
|
||||||
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user