1
0
This commit is contained in:
Scott E. Graves
2017-04-11 13:41:21 -05:00
parent fe50099c00
commit e7d11e5b14
4 changed files with 27 additions and 24 deletions

View File

@@ -90,9 +90,9 @@ const std::uint8_t SIA_BLOCK_TIME_MINS = 10;
const std::uint32_t MINUTES_PER_MONTH = (730 * 60);
const std::uint32_t SIA_BLOCKS_PER_MONTH = MINUTES_PER_MONTH / SIA_BLOCK_TIME_MINS;
const std::uint32_t SIA_DEFAULT_HOST_COUNT = 24;
const std::uint32_t SIA_DEFAULT_RENEW_WINDOW = ((1440 / SIA_BLOCK_TIME_MINS) * 14);
const SiaCurrency SIA_DEFAULT_MINIMUM_FUNDS = 4000;
const std::uint32_t SIA_DEFAULT_CONTRACT_LENGTH = SIA_BLOCKS_PER_MONTH * 3;
const std::uint32_t SIA_DEFAULT_RENEW_WINDOW = SIA_DEFAULT_CONTRACT_LENGTH / 3;
#define DEFAULT_CONFIG_FILE_PATH L"./config/siadriveconfig.json"
#define DEFAULT_RENTER_DB_FILE_PATH L"./config/renter_upload.db3"
@@ -202,26 +202,8 @@ inline static SString SiaCurrencyToGB(const SiaCurrency& value)
return value.ToWString(conv);
}
inline static SString BytesToFriendlyDisplay(const SiaCurrency& bytes)
{
SString units[] = { "B", "KB", "MB", "GB", "TB", "PB" };
SString readableunit = "B";
SiaCurrency readablesize = bytes;
for (const auto& unit : units)
{
if (readablesize < 1000)
{
readableunit = unit;
break;
}
readablesize /= 1000;
}
ttmath::Conv conv;
conv.scient_from = 256;
conv.base = 10;
conv.round = 2;
return readablesize.ToWString(conv) + ' ' + readableunit;
}
SString SIADRIVE_EXPORTABLE BytesToFriendlyDisplay(const SiaCurrency& bytes);
BOOL SIADRIVE_EXPORTABLE RetryAction(std::function<BOOL()> func, std::uint16_t retryCount, const DWORD& retryDelay);