From 41df1f9c4a5fc2709dec761a40160e833af0924d Mon Sep 17 00:00:00 2001
From: Oliver Bock <oliver.bock@aei.mpg.de>
Date: Fri, 9 May 2008 22:51:18 +0200
Subject: [PATCH] HUD "CPU Time" display now shows the total time (previously
 accumulated + current session)

---
 BOINCClientAdapter.cpp | 5 +++++
 BOINCClientAdapter.h   | 7 +++++++
 StarsphereS5R3.cpp     | 4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/BOINCClientAdapter.cpp b/BOINCClientAdapter.cpp
index 6245478..3b6523e 100644
--- a/BOINCClientAdapter.cpp
+++ b/BOINCClientAdapter.cpp
@@ -149,3 +149,8 @@ double BOINCClientAdapter::wuDiskBound() const
 {
 	return m_UserData.rsc_disk_bound;
 }
+
+double BOINCClientAdapter::wuCPUTimeSpent() const
+{
+	return m_UserData.wu_cpu_time;
+}
diff --git a/BOINCClientAdapter.h b/BOINCClientAdapter.h
index 449c072..d3659b0 100644
--- a/BOINCClientAdapter.h
+++ b/BOINCClientAdapter.h
@@ -122,6 +122,13 @@ public:
     double wuFPOpsBound() const;
     double wuMemoryBound() const;
     double wuDiskBound() const;
+
+	/**
+	 * \brief Retrieves the accumulated time spent on the currently active work unit
+	 * 
+	 * \return The time spent on the work unit
+	 */
+    double wuCPUTimeSpent() const;
     
     /**
      * \brief Retrieves information provided by the running science application
diff --git a/StarsphereS5R3.cpp b/StarsphereS5R3.cpp
index 762dba5..b84d9fc 100644
--- a/StarsphereS5R3.cpp
+++ b/StarsphereS5R3.cpp
@@ -72,8 +72,8 @@ void StarsphereS5R3::refreshBOINCInformation()
 	m_WUPercentDone = buffer.str();
 	buffer.str("");
 	
-	/// \todo Show accumulated time (init_data time + shmem time)
-	const double cputime = m_EinsteinAdapter.wuCPUTime();
+	// show WU's total CPU time (previously accumulated + current session) 
+	const double cputime = m_BoincAdapter.wuCPUTimeSpent() + m_EinsteinAdapter.wuCPUTime();
 	const int hrs =  cputime / 3600;
 	const int min = (cputime - hrs*3600) / 60;
 	const int sec =  cputime - (hrs*3600 + min*60);	
-- 
GitLab