summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/Timer.cpp
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2009-03-15 05:34:35 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2009-03-15 05:34:35 +0000
commit34e8b88c8c089a3295eb3b3039f249a3bc957b55 (patch)
tree1d85c72cf74be83a7ddffc2cf8c75351bac722fd /Source/Core/Common/Src/Timer.cpp
parent7178c8d686b73e7643c04e0392497afc2bfc1e24 (diff)
fix Timer::GetTimeFormatted
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2659 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/Timer.cpp')
-rw-r--r--Source/Core/Common/Src/Timer.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/Core/Common/Src/Timer.cpp b/Source/Core/Common/Src/Timer.cpp
index 903133640f..50a928ea8c 100644
--- a/Source/Core/Common/Src/Timer.cpp
+++ b/Source/Core/Common/Src/Timer.cpp
@@ -193,12 +193,20 @@ u64 Timer::GetLocalTimeSinceJan1970()
// Return the current time formatted as Minutes:Seconds:Milliseconds in the form 00:00:000
std::string Timer::GetTimeFormatted()
{
+ time_t sysTime;
+ struct tm * gmTime;
+ char formattedTime[13];
+
+ time(&sysTime);
+ gmTime = localtime(&sysTime);
+ strftime(formattedTime, 6, "%M:%S", gmTime);
+
+ // Now tack on the milliseconds
struct timeb tp;
(void)::ftime(&tp);
- char temp[32];
- sprintf(temp, "%02ld:%02ld:%03i", tp.time/60, tp.time%60, tp.millitm);
+ sprintf(formattedTime, "%s:%03i", formattedTime, tp.millitm);
- return std::string(temp);
+ return std::string(formattedTime);
}
/////////////////////////////////////