show drive stats human readable
This commit is contained in:
parent
99273756da
commit
29eda094a7
|
@ -24,6 +24,8 @@
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include<algorithm>
|
#include<algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -67,12 +67,18 @@ string Drive::sCapacityToText()
|
||||||
|
|
||||||
|
|
||||||
string Drive::sPowerOnHoursToText(){
|
string Drive::sPowerOnHoursToText(){
|
||||||
|
double dYears = 0U;
|
||||||
|
uint32_t u32Hours = getPowerOnHours();
|
||||||
|
stringstream stream;
|
||||||
|
|
||||||
//TODO show in human readable format
|
dYears = (double) ((double)u32Hours/(double)8760U);
|
||||||
|
|
||||||
return to_string(getPowerOnHours());
|
stream << fixed << setprecision(2) << dYears;
|
||||||
|
string sRet = to_string(getPowerOnHours()) + " hours or " + stream.str() + " years";
|
||||||
|
|
||||||
|
return sRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Drive::sPowerCyclesToText(){
|
string Drive::sPowerCyclesToText(){
|
||||||
return to_string(getPowerCycles());
|
return to_string(getPowerCycles());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue