Changeset View
Changeset View
Standalone View
Standalone View
src/utilmoneystr.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2015 The Bitcoin Core developers | // Copyright (c) 2009-2015 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "utilmoneystr.h" | #include <utilmoneystr.h> | ||||
#include "primitives/transaction.h" | #include <primitives/transaction.h> | ||||
#include "tinyformat.h" | #include <tinyformat.h> | ||||
#include "utilstrencodings.h" | #include <utilstrencodings.h> | ||||
std::string FormatMoney(const Amount amt) { | std::string FormatMoney(const Amount amt) { | ||||
// Note: not using straight sprintf here because we do NOT want localized | // Note: not using straight sprintf here because we do NOT want localized | ||||
// number formatting. | // number formatting. | ||||
Amount amt_abs = amt > Amount::zero() ? amt : -amt; | Amount amt_abs = amt > Amount::zero() ? amt : -amt; | ||||
std::string str = | std::string str = | ||||
strprintf("%d.%08d", amt_abs / COIN, (amt_abs % COIN) / SATOSHI); | strprintf("%d.%08d", amt_abs / COIN, (amt_abs % COIN) / SATOSHI); | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |