fixing #1945
This commit is contained in:
parent
16a8907e5d
commit
3944d3d8da
1 changed files with 19 additions and 8 deletions
|
@ -205,21 +205,32 @@ TimeConversion :: timeDurationToHhMmSsString(
|
||||||
Ptr<time_duration>::Ref duration)
|
Ptr<time_duration>::Ref duration)
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
|
int hours = duration->hours();
|
||||||
|
int minutes = duration->minutes();
|
||||||
|
int seconds = duration->seconds();
|
||||||
|
|
||||||
|
if (duration->fractional_seconds() >= 500000) {
|
||||||
|
++seconds;
|
||||||
|
}
|
||||||
|
if (seconds == 60) {
|
||||||
|
seconds = 0;
|
||||||
|
++minutes;
|
||||||
|
}
|
||||||
|
if (minutes == 60) {
|
||||||
|
minutes = 0;
|
||||||
|
++hours;
|
||||||
|
}
|
||||||
|
|
||||||
std::stringstream stringStream;
|
std::stringstream stringStream;
|
||||||
stringStream << std::dec
|
stringStream << std::dec
|
||||||
<< std::setw(2)
|
<< std::setw(2)
|
||||||
<< std::setfill('0')
|
<< std::setfill('0')
|
||||||
<< duration->hours()
|
<< hours
|
||||||
<< ":"
|
<< ":"
|
||||||
<< std::setw(2)
|
<< std::setw(2)
|
||||||
<< std::setfill('0')
|
<< std::setfill('0')
|
||||||
<< duration->minutes();
|
<< minutes
|
||||||
|
<< ":"
|
||||||
int seconds = duration->seconds();
|
|
||||||
if (duration->fractional_seconds() >= 500000) {
|
|
||||||
++seconds;
|
|
||||||
}
|
|
||||||
stringStream << ":"
|
|
||||||
<< std::setw(2)
|
<< std::setw(2)
|
||||||
<< std::setfill('0')
|
<< std::setfill('0')
|
||||||
<< seconds;
|
<< seconds;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue