Fixed time appearance in thumbnail view (now shows leading zeroes in min and sec)

This commit is contained in:
Ilia Popov
2010-05-15 16:08:35 +02:00
parent c7fc00080b
commit 422aaacaac

View File

@@ -19,6 +19,7 @@
#include <multilangmgr.h> #include <multilangmgr.h>
#include <thumbnail.h> #include <thumbnail.h>
#include <sstream> #include <sstream>
#include <iomanip>
#include <options.h> #include <options.h>
#include <mytime.h> #include <mytime.h>
#include <stdio.h> #include <stdio.h>
@@ -268,25 +269,28 @@ void Thumbnail::generateExifDateTimeStrings () {
std::ostringstream ostr; std::ostringstream ostr;
bool spec = false; bool spec = false;
for (int i=0; i<dateFormat.size(); i++) for (int i=0; i<dateFormat.size(); i++)
if (spec && dateFormat[i]=='y') { if (spec && dateFormat[i]=='y') {
ostr << cfs.year; ostr << cfs.year;
spec = false; spec = false;
} }
else if (spec && dateFormat[i]=='m') { else if (spec && dateFormat[i]=='m') {
ostr << (int)cfs.month; ostr << (int)cfs.month;
spec = false; spec = false;
} }
else if (spec && dateFormat[i]=='d') { else if (spec && dateFormat[i]=='d') {
ostr << (int)cfs.day; ostr << (int)cfs.day;
spec = false; spec = false;
} }
else if (dateFormat[i]=='%') else if (dateFormat[i]=='%')
spec = true; spec = true;
else { else {
ostr << (char)dateFormat[i]; ostr << (char)dateFormat[i];
spec = false; spec = false;
} }
ostr << " " << (int)cfs.hour << ":" << (int)cfs.min << ":" << (int)cfs.sec;
ostr << " " << (int)cfs.hour;
ostr << ":" << std::setw(2) << std::setfill('0') << (int)cfs.min;
ostr << ":" << std::setw(2) << std::setfill('0') << (int)cfs.sec;
dateTimeString = ostr.str (); dateTimeString = ostr.str ();
} }