mirror of
https://github.com/overte-org/overte.git
synced 2025-07-28 17:30:00 +02:00
don't use powf for credit conversions
This commit is contained in:
parent
15a8272286
commit
1b00cda068
3 changed files with 5 additions and 3 deletions
|
@ -735,7 +735,7 @@ void DomainServer::setupPendingAssignmentCredits() {
|
||||||
|
|
||||||
const float CREDITS_PER_HOUR = 0.10f;
|
const float CREDITS_PER_HOUR = 0.10f;
|
||||||
const float CREDITS_PER_MSEC = CREDITS_PER_HOUR / (60 * 60 * 1000);
|
const float CREDITS_PER_MSEC = CREDITS_PER_HOUR / (60 * 60 * 1000);
|
||||||
const int SATOSHIS_PER_MSEC = CREDITS_PER_MSEC * powf(10.0f, 8.0f);
|
const int SATOSHIS_PER_MSEC = CREDITS_PER_MSEC * SATOSHIS_PER_UNIT;
|
||||||
|
|
||||||
float pendingCredits = elapsedMsecsSinceLastPayment * SATOSHIS_PER_MSEC;
|
float pendingCredits = elapsedMsecsSinceLastPayment * SATOSHIS_PER_MSEC;
|
||||||
|
|
||||||
|
@ -887,7 +887,7 @@ QJsonObject DomainServer::jsonObjectForNode(const SharedNodePointer& node) {
|
||||||
double pendingCreditAmount = 0;
|
double pendingCreditAmount = 0;
|
||||||
|
|
||||||
while (i != _pendingAssignmentCredits.end() && i.key() == nodeData->getWalletUUID()) {
|
while (i != _pendingAssignmentCredits.end() && i.key() == nodeData->getWalletUUID()) {
|
||||||
pendingCreditAmount += i.value()->getAmount() * powf(10.0f, -8.0f);
|
pendingCreditAmount += i.value()->getAmount() / SATOSHIS_PER_CREDIT;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3108,7 +3108,7 @@ void Application::updateWindowTitle(){
|
||||||
|
|
||||||
AccountManager& accountManager = AccountManager::getInstance();
|
AccountManager& accountManager = AccountManager::getInstance();
|
||||||
if (accountManager.getAccountInfo().hasBalance()) {
|
if (accountManager.getAccountInfo().hasBalance()) {
|
||||||
float creditBalance = accountManager.getAccountInfo().getBalance() * pow(10.0f, -8.0f);
|
float creditBalance = accountManager.getAccountInfo().getBalance() / SATOSHIS_PER_CREDIT;
|
||||||
|
|
||||||
QString creditBalanceString;
|
QString creditBalanceString;
|
||||||
creditBalanceString.sprintf("%.8f", creditBalance);
|
creditBalanceString.sprintf("%.8f", creditBalance);
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
#include "OAuthAccessToken.h"
|
#include "OAuthAccessToken.h"
|
||||||
|
|
||||||
|
const float SATOSHIS_PER_CREDIT = 10.0e8f;
|
||||||
|
|
||||||
class DataServerAccountInfo : public QObject {
|
class DataServerAccountInfo : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue