From 088dac66705b06aebefff8689df932b4275d2010 Mon Sep 17 00:00:00 2001 From: edisionnano Date: Sun, 8 Jun 2025 22:29:50 +0300 Subject: [PATCH] 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 --- src/mainwindow.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e106aa3..d090a15 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -609,8 +609,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal } else if (attrObj["name"] == "Total_LBAs_Written") { int logicalBlockSize = localObj["logical_block_size"].toInt(); qlonglong lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong(); - qlonglong oneGB = static_cast(std::pow(2, 30)); - qlonglong gigabytes = (lbaWritten * logicalBlockSize) / oneGB; + qlonglong gigabytes = (lbaWritten * logicalBlockSize) / 1e9; int gigabytesInt = static_cast(gigabytes); if (!gigabytesInt) { gigabytesInt = static_cast(lbaWritten); @@ -634,8 +633,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal } else if (attrObj["name"] == "Total_LBAs_Read") { int logicalBlockSize = localObj["logical_block_size"].toInt(); qlonglong lbaRead = attrObj["raw"].toObject()["value"].toVariant().toLongLong(); - qlonglong oneGB = static_cast(std::pow(2, 30)); - qlonglong gigabytes = (lbaRead * logicalBlockSize) / oneGB; + qlonglong gigabytes = (lbaRead * logicalBlockSize) / 1e9; int gigabytesInt = static_cast(gigabytes); if (!gigabytesInt) { gigabytesInt = static_cast(lbaRead); @@ -653,8 +651,7 @@ void MainWindow::populateWindow(const QJsonObject &localObj, const QString &heal if (attrObj["name"] == "Total_LBAs_Written") { int logicalBlockSize = localObj["logical_block_size"].toInt(); qlonglong lbaWritten = attrObj["raw"].toObject()["value"].toVariant().toLongLong(); - qlonglong oneGB = static_cast(std::pow(2, 30)); - qlonglong gigabytes = (lbaWritten * logicalBlockSize) / oneGB; + qlonglong gigabytes = (lbaWritten * logicalBlockSize) / 1e9; totalWritesInt = static_cast(gigabytes); } } else if (attrObj["name"] == "Remaining_Lifetime_Perc") {