Skip to content
Snippets Groups Projects
Commit bd1a1900 authored by Oliver Bock's avatar Oliver Bock
Browse files

S5R3 engine's clock now shows localtime

parent fe4bccc4
No related branches found
No related tags found
No related merge requests found
...@@ -158,10 +158,10 @@ void StarsphereRadio::refreshBOINCInformation() ...@@ -158,10 +158,10 @@ void StarsphereRadio::refreshBOINCInformation()
buffer.str(""); buffer.str("");
// show WU's total CPU time (previously accumulated + current session) // show WU's total CPU time (previously accumulated + current session)
const double time = m_BoincAdapter.wuCPUTimeSpent() + m_EinsteinAdapter.wuCPUTime(); const double timeCPU = m_BoincAdapter.wuCPUTimeSpent() + m_EinsteinAdapter.wuCPUTime();
const int hrs = time / 3600; const int hrs = timeCPU / 3600;
const int min = fmod(time, 3600) / 60; const int min = fmod(timeCPU, 3600) / 60;
const int sec = fmod(time, 60); const int sec = fmod(timeCPU, 60);
buffer << "WU CPU Time: " << right << setw(2) << hrs << ":" buffer << "WU CPU Time: " << right << setw(2) << hrs << ":"
<< right << setw(2) << min << ":" << right << setw(2) << min << ":"
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "StarsphereS5R3.h" #include "StarsphereS5R3.h"
#include <time.h>
StarsphereS5R3::StarsphereS5R3() : StarsphereS5R3::StarsphereS5R3() :
Starsphere(EinsteinS5R3Adapter::SharedMemoryIdentifier), Starsphere(EinsteinS5R3Adapter::SharedMemoryIdentifier),
m_EinsteinAdapter(&m_BoincAdapter) m_EinsteinAdapter(&m_BoincAdapter)
...@@ -98,10 +100,10 @@ void StarsphereS5R3::refreshBOINCInformation() ...@@ -98,10 +100,10 @@ void StarsphereS5R3::refreshBOINCInformation()
m_WUPercentDone = buffer.str(); m_WUPercentDone = buffer.str();
// show WU's total CPU time (previously accumulated + current session) // show WU's total CPU time (previously accumulated + current session)
double time = m_BoincAdapter.wuCPUTimeSpent() + m_EinsteinAdapter.wuCPUTime(); double timeCPU = m_BoincAdapter.wuCPUTimeSpent() + m_EinsteinAdapter.wuCPUTime();
int hrs = time / 3600; int hrs = timeCPU / 3600;
int min = fmod(time, 3600) / 60; int min = fmod(timeCPU, 3600) / 60;
int sec = fmod(time, 60); int sec = fmod(timeCPU, 60);
buffer.str(""); buffer.str("");
buffer << "CPU Time: " << right << setw(2) << hrs << ":" buffer << "CPU Time: " << right << setw(2) << hrs << ":"
...@@ -111,17 +113,12 @@ void StarsphereS5R3::refreshBOINCInformation() ...@@ -111,17 +113,12 @@ void StarsphereS5R3::refreshBOINCInformation()
m_WUCPUTime = buffer.str(); m_WUCPUTime = buffer.str();
// update current time string (clock) // update current time string (clock)
time = dtime() - dday(); char cBuffer[10] = {0};
hrs = time / 3600; time_t timeNow = time(0);
min = fmod(time, 3600) / 60; struct tm* timeLocal = localtime(&timeNow);
sec = fmod(time, 60); strftime(cBuffer, sizeof(cBuffer) - 1, "%H:%M:%S", timeLocal);
buffer.str("");
buffer << right << setw(2) << hrs << ":"
<< right << setw(2) << min << ":"
<< right << setw(2) << sec << ends;
m_CurrentTime = buffer.str(); m_CurrentTime = string(cBuffer);
} }
void StarsphereS5R3::renderSearchInformation() void StarsphereS5R3::renderSearchInformation()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment