[StopWatch] Fix rounding issue 54/106454/6
authorKamil Lipiszko <k.lipiszko@samsung.com>
Wed, 21 Dec 2016 14:48:46 +0000 (15:48 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 5 Jan 2017 14:06:28 +0000 (06:06 -0800)
Change-Id: I984674bc96f94d7beb05a217984b8b4a32d4bc8d

clock/src/Presenter/StopWatchPresenter.cpp
clock/src/View/CounterView.cpp

index 486ac6c..a0062a4 100644 (file)
@@ -144,12 +144,14 @@ void StopWatchPresenter::TimeUpdateRequest()
 
 StopWatchPresenter::Time StopWatchPresenter::GetTimeStructure(milliseconds time)
 {
+       time = milliseconds((unsigned)std::round((double)time.count() / 10) * 10);
+
        Time ts;
 
        ts.Hour = duration_cast<hours>(time).count() % 100;
        ts.Min = duration_cast<minutes>(time).count() % 60;
        ts.Sec = duration_cast<seconds>(time).count() % 60;
-       ts.Msec = duration_cast<milliseconds>(time).count() % 1000;
+       ts.Msec = duration_cast<milliseconds>(time).count() % 1000 / 10;
 
        return ts;
 }
@@ -159,8 +161,6 @@ std::string StopWatchPresenter::GetTimeString(std::chrono::milliseconds time)
        auto ts = GetTimeStructure(time);
        std::stringstream stringStream;
 
-       ts.Msec = (unsigned)std::round((double)ts.Msec / 10);
-
        if (ts.Hour > 0)
                stringStream << (unsigned)(ts.Hour / 10) << ts.Hour % 10 << ":";
 
index 8eced7c..062f849 100644 (file)
@@ -105,8 +105,6 @@ const char *CounterView::GetEdjeFilePath()
 
 void CounterView::DisplayTime(int hour, int min, int sec, int msec)
 {
-       msec /= 10;
-
        std::stringstream text;
        std::stringstream subtext;