summaryrefslogtreecommitdiff
path: root/zen/format_unit.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2015-10-02 14:50:33 +0200
committerDaniel Wilhelm <daniel@wili.li>2015-10-02 14:50:33 +0200
commitb6d9c83c8386c83f0e2c3ffeaded184f60635bb4 (patch)
treeb404f53d08361eef07350d21f4002f8b1def711c /zen/format_unit.cpp
parent6.6 (diff)
downloadFreeFileSync-b6d9c83c8386c83f0e2c3ffeaded184f60635bb4.tar.gz
FreeFileSync-b6d9c83c8386c83f0e2c3ffeaded184f60635bb4.tar.bz2
FreeFileSync-b6d9c83c8386c83f0e2c3ffeaded184f60635bb4.zip
6.7
Diffstat (limited to 'zen/format_unit.cpp')
-rw-r--r--zen/format_unit.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/zen/format_unit.cpp b/zen/format_unit.cpp
index 1568b616..bcf318d9 100644
--- a/zen/format_unit.cpp
+++ b/zen/format_unit.cpp
@@ -96,22 +96,22 @@ std::wstring formatUnitTime(int val, UnitRemTime unit)
template <int M, int N>
-std::wstring roundToBlock(double timeHigh,
+std::wstring roundToBlock(double timeInHigh,
UnitRemTime unitHigh, const int (&stepsHigh)[M],
int unitLowPerHigh,
UnitRemTime unitLow, const int (&stepsLow)[N])
{
assert(unitLowPerHigh > 0);
const double granularity = 0.1;
- const double timeLow = timeHigh * unitLowPerHigh;
- const int blockSizeLow = granularity * timeHigh < 1 ?
- numeric::nearMatch(granularity * timeLow, std::begin(stepsLow), std::end(stepsLow)):
- numeric::nearMatch(granularity * timeHigh, std::begin(stepsHigh), std::end(stepsHigh)) * unitLowPerHigh;
- const int roundedTimeLow = numeric::round(timeLow / blockSizeLow) * blockSizeLow;
+ const double timeInLow = timeInHigh * unitLowPerHigh;
+ const int blockSizeLow = granularity * timeInHigh < 1 ?
+ numeric::nearMatch(granularity * timeInLow, std::begin(stepsLow), std::end(stepsLow)):
+ numeric::nearMatch(granularity * timeInHigh, std::begin(stepsHigh), std::end(stepsHigh)) * unitLowPerHigh;
+ const int roundedtimeInLow = numeric::round(timeInLow / blockSizeLow) * blockSizeLow;
- std::wstring output = formatUnitTime(roundedTimeLow / unitLowPerHigh, unitHigh);
+ std::wstring output = formatUnitTime(roundedtimeInLow / unitLowPerHigh, unitHigh);
if (unitLowPerHigh > blockSizeLow)
- output += L" " + formatUnitTime(roundedTimeLow % unitLowPerHigh, unitLow);
+ output += L" " + formatUnitTime(roundedtimeInLow % unitLowPerHigh, unitLow);
return output;
};
}
bgstack15