From c4cbac493fbb331e1306f776f16dd667d27eed93 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Sat, 30 Apr 2011 17:10:56 +0200 Subject: [PATCH] Removed Platform::TimeString() and replaced with ctime() --- iphone/Maps/Platform/IPhonePlatform.hpp | 1 - iphone/Maps/Platform/IPhonePlatform.mm | 9 --------- map/framework.cpp | 6 ++++-- map/framework.hpp | 1 - platform/platform.hpp | 2 -- platform/qtplatform.cpp | 27 ------------------------- 6 files changed, 4 insertions(+), 42 deletions(-) diff --git a/iphone/Maps/Platform/IPhonePlatform.hpp b/iphone/Maps/Platform/IPhonePlatform.hpp index c11e47062a..f3ce61e707 100644 --- a/iphone/Maps/Platform/IPhonePlatform.hpp +++ b/iphone/Maps/Platform/IPhonePlatform.hpp @@ -24,7 +24,6 @@ public: virtual bool IsBenchmarking() const; virtual bool IsVisualLog() const; virtual string const DeviceID() const; - virtual string const TimeString() const; virtual unsigned ScaleEtalonSize() const; private: diff --git a/iphone/Maps/Platform/IPhonePlatform.mm b/iphone/Maps/Platform/IPhonePlatform.mm index f40c34802a..c8bac0ad74 100644 --- a/iphone/Maps/Platform/IPhonePlatform.mm +++ b/iphone/Maps/Platform/IPhonePlatform.mm @@ -220,15 +220,6 @@ string const IPhonePlatform::DeviceID() const return m_deviceID; } -string const IPhonePlatform::TimeString() const -{ - NSDate * now = [NSDate date]; - NSString * timeString = [m_dateFormatter stringFromDate:now]; - string res = string([timeString UTF8String]); - [timeString release]; - return res; -} - Platform & GetPlatform() { static IPhonePlatform platform; diff --git a/map/framework.cpp b/map/framework.cpp index 17c5cab7d8..9f0c1d61cc 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -277,7 +277,6 @@ void FrameWork::AddRedrawCommandSure() m_centeringMode(EDoNothing), m_maxDuration(0) { - m_startTime = GetPlatform().TimeString(); m_informationDisplay.setBottomShift(bottomShift); #ifdef DRAW_TOUCH_POINTS m_informationDisplay.enableDebugPoints(true); @@ -339,11 +338,14 @@ void FrameWork::AddRedrawCommandSure() { ofstream fout(GetPlatform().WritablePathForFile("benchmark_results.txt").c_str(), ios::app); + time_t curTime = time(NULL); + string const startTime(ctime(&curTime)); + for (int i = 0; i < m_benchmarkResults.size(); ++i) { fout << GetPlatform().DeviceID() << " " << VERSION_STRING << " " - << m_startTime << " " + << startTime << " " << m_benchmarkResults[i].m_name << " " << m_benchmarkResults[i].m_rect.minX() << " " << m_benchmarkResults[i].m_rect.minY() << " " diff --git a/map/framework.hpp b/map/framework.hpp index 7866918f91..7aef84be8c 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -148,7 +148,6 @@ class FrameWork vector m_benchmarkResults; my::Timer m_benchmarksTimer; - string m_startTime; struct Benchmark { diff --git a/platform/platform.hpp b/platform/platform.hpp index 10d154f4ef..fb3279fa6e 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -18,8 +18,6 @@ public: /// Time in seconds passed from application start virtual double TimeInSec() const = 0; - virtual string const TimeString() const = 0; - /// @return always the same writable dir for current user with slash at the end virtual string WritableDir() const = 0; /// @return full path to file in user's writable directory diff --git a/platform/qtplatform.cpp b/platform/qtplatform.cpp index 40622e7315..d068637258 100644 --- a/platform/qtplatform.cpp +++ b/platform/qtplatform.cpp @@ -414,33 +414,6 @@ public: { return 512 + 256; } - - string const TimeString() const - { - time_t rawtime; - time(&rawtime); - tm * ltime; - ltime = localtime(&rawtime); - - static char const * wday_name[7] = { - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" - }; - - static char const * mon_name[12] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - - static char result[26]; - - sprintf(result, "%s_%s_%d_%d:%d:%d_%d", - wday_name[ltime->tm_wday], - mon_name[ltime->tm_mon], - ltime->tm_mday, ltime->tm_hour, - ltime->tm_min, ltime->tm_sec, - 1900 + ltime->tm_year); - return string(result); - } }; extern "C" Platform & GetPlatform()