mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
Some tidy up of sprintf to StringFromFormat
This commit is contained in:
@ -167,27 +167,23 @@ u64 Timer::GetLocalTimeSinceJan1970()
|
||||
std::string Timer::GetTimeFormatted()
|
||||
{
|
||||
time_t sysTime;
|
||||
struct tm * gmTime;
|
||||
char formattedTime[13];
|
||||
char tmp[13];
|
||||
|
||||
time(&sysTime);
|
||||
gmTime = localtime(&sysTime);
|
||||
|
||||
struct tm * gmTime = localtime(&sysTime);
|
||||
|
||||
char tmp[13];
|
||||
strftime(tmp, 6, "%M:%S", gmTime);
|
||||
|
||||
// Now tack on the milliseconds
|
||||
#ifdef _WIN32
|
||||
struct timeb tp;
|
||||
(void)::ftime(&tp);
|
||||
sprintf(formattedTime, "%s:%03i", tmp, tp.millitm);
|
||||
return StringFromFormat("%s:%03i", tmp, tp.millitm);
|
||||
#else
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, NULL);
|
||||
sprintf(formattedTime, "%s:%03d", tmp, (int)(t.tv_usec / 1000));
|
||||
return StringFromFormat("%s:%03d", tmp, (int)(t.tv_usec / 1000));
|
||||
#endif
|
||||
|
||||
return std::string(formattedTime);
|
||||
}
|
||||
|
||||
// Returns a timestamp with decimals for precise time comparisons
|
||||
|
Reference in New Issue
Block a user