2022-02-19 02:31:16 +01:00
|
|
|
//=====================================================================================//
|
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
//
|
|
|
|
//=====================================================================================//
|
|
|
|
|
|
|
|
#include <core/stdafx.h>
|
2023-02-15 20:50:12 +01:00
|
|
|
#include <tier1/strtools.h>
|
2022-02-19 02:31:16 +01:00
|
|
|
#include <engine/common.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============================
|
2023-04-02 17:02:04 +02:00
|
|
|
COM_FormatSeconds
|
2022-02-19 02:31:16 +01:00
|
|
|
|
|
|
|
==============================
|
|
|
|
*/
|
2023-02-15 20:50:12 +01:00
|
|
|
const char* COM_FormatSeconds(int seconds)
|
|
|
|
{
|
|
|
|
static char string[64];
|
|
|
|
|
|
|
|
int hours = 0;
|
|
|
|
int minutes = seconds / 60;
|
|
|
|
|
|
|
|
if (minutes > 0)
|
|
|
|
{
|
|
|
|
seconds -= (minutes * 60);
|
|
|
|
hours = minutes / 60;
|
|
|
|
|
|
|
|
if (hours > 0)
|
|
|
|
{
|
|
|
|
minutes -= (hours * 60);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hours > 0)
|
|
|
|
{
|
|
|
|
Q_snprintf(string, sizeof(string), "%2i:%02i:%02i", hours, minutes, seconds);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Q_snprintf(string, sizeof(string), "%02i:%02i", minutes, seconds);
|
|
|
|
}
|
|
|
|
|
|
|
|
return string;
|
|
|
|
}
|