Windows: use wcsftime instead of strftime

This commit is contained in:
Jean-Francois Dockes
2020-04-16 14:01:06 +01:00
parent 6037576912
commit 5fd492da57
6 changed files with 31 additions and 17 deletions
+4 -6
View File
@@ -491,23 +491,21 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
int curidx = pvTab->currentIndex();
pvTab->setTabText(curidx, title);
char datebuf[100];
datebuf[0] = 0;
string datebuf;
if (!doc.fmtime.empty() || !doc.dmtime.empty()) {
time_t mtime = doc.dmtime.empty() ?
atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str());
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, "%Y-%m-%d %H:%M:%S", tm);
datebuf = utf8datestring("%Y-%m-%d %H:%M:%S", tm);
}
LOGDEB("Doc.url: [" << doc.url << "]\n");
string url;
printableUrl(theconfig->getDefCharset(), doc.url, url);
string tiptxt = url + string("\n");
tiptxt += doc.mimetype + " " + string(datebuf) + "\n";
tiptxt += doc.mimetype + " " + datebuf + "\n";
if (!ctitle.empty())
tiptxt += ctitle + "\n";
pvTab->setTabToolTip(curidx,
QString::fromUtf8(tiptxt.c_str(), tiptxt.length()));
pvTab->setTabToolTip(curidx, u8s2qs(tiptxt));
PreviewTextEdit *e = currentEditor();
if (e) {
+3 -7
View File
@@ -194,26 +194,22 @@ static string dategetter(const string&, const Rcl::Doc& doc)
{
string sdate;
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
char datebuf[100];
datebuf[0] = 0;
time_t mtime = doc.dmtime.empty() ?
atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str());
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, "%Y-%m-%d", tm);
transcode(datebuf, sdate, RclConfig::getLocaleCharset(), "UTF-8");
sdate = utf8datestring("%Y-%m-%d", tm);
}
return sdate;
}
static string datetimegetter(const string&, const Rcl::Doc& doc)
{
char datebuf[100];
datebuf[0] = 0;
string datebuf;
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
time_t mtime = doc.dmtime.empty() ?
atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str());
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, prefs.creslistdateformat.c_str(), tm);
datebuf = utf8datestring(prefs.creslistdateformat.c_str(), tm);
}
return datebuf;
}