Use GigaBytes instead of GibiBytes

There's much confusion around this in the digital world, perhaps we should make this configurable but since we advertise GB currently we should actually show GB
This commit is contained in:
edisionnano
2025-06-08 22:29:50 +03:00
committed by GitHub
parent d6a117f9c7
commit 088dac6670

View File

@@ -609,8 +609,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
} else if (attrObj["name"] == "Total_LBAs_Written") { } else if (attrObj["name"] == "Total_LBAs_Written") {
int logicalBlockSize = localObj["logical_block_size"].toInt(); int logicalBlockSize = localObj["logical_block_size"].toInt();
qlonglong lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong(); qlonglong lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
qlonglong oneGB = static_cast<qlonglong>(std::pow(2, 30)); qlonglong gigabytes = (lbaWritten * logicalBlockSize) / 1e9;
qlonglong gigabytes = (lbaWritten * logicalBlockSize) / oneGB;
int gigabytesInt = static_cast<int>(gigabytes); int gigabytesInt = static_cast<int>(gigabytes);
if (!gigabytesInt) { if (!gigabytesInt) {
gigabytesInt = static_cast<int>(lbaWritten); gigabytesInt = static_cast<int>(lbaWritten);
@@ -634,8 +633,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
} else if (attrObj["name"] == "Total_LBAs_Read") { } else if (attrObj["name"] == "Total_LBAs_Read") {
int logicalBlockSize = localObj["logical_block_size"].toInt(); int logicalBlockSize = localObj["logical_block_size"].toInt();
qlonglong lbaRead = attrObj["raw"].toObject()["value"].toVariant().toLongLong(); qlonglong lbaRead = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
qlonglong oneGB = static_cast<qlonglong>(std::pow(2, 30)); qlonglong gigabytes = (lbaRead * logicalBlockSize) / 1e9;
qlonglong gigabytes = (lbaRead * logicalBlockSize) / oneGB;
int gigabytesInt = static_cast<int>(gigabytes); int gigabytesInt = static_cast<int>(gigabytes);
if (!gigabytesInt) { if (!gigabytesInt) {
gigabytesInt = static_cast<int>(lbaRead); gigabytesInt = static_cast<int>(lbaRead);
@@ -653,8 +651,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal
if (attrObj["name"] == "Total_LBAs_Written") { if (attrObj["name"] == "Total_LBAs_Written") {
int logicalBlockSize = localObj["logical_block_size"].toInt(); int logicalBlockSize = localObj["logical_block_size"].toInt();
qlonglong lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong(); qlonglong lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong();
qlonglong oneGB = static_cast<qlonglong>(std::pow(2, 30)); qlonglong gigabytes = (lbaWritten * logicalBlockSize) / 1e9;
qlonglong gigabytes = (lbaWritten * logicalBlockSize) / oneGB;
totalWritesInt = static_cast<int>(gigabytes); totalWritesInt = static_cast<int>(gigabytes);
} }
} else if (attrObj["name"] == "Remaining_Lifetime_Perc") { } else if (attrObj["name"] == "Remaining_Lifetime_Perc") {