]> git.lyx.org Git - lyx.git/blobdiff - src/support/lyxtime.cpp
Re-fix #11146 with recent LaTeX
[lyx.git] / src / support / lyxtime.cpp
index 3150825d753f80c3dd95ae15b6147b5c4a8d5114..f3318eb3f0e35aeea8bf98021c1fb84a1061c11e 100644 (file)
@@ -31,12 +31,15 @@ time_t current_time()
 }
 
 
-string const formatted_time(time_t t, string const & fmt)
+docstring formatted_datetime(time_t t, string const & fmt)
 {
-       struct tm * loc_tm = localtime(&t);
-       char date[50];
-       strftime(date, sizeof(date), fmt.c_str(), loc_tm);
-       return string(date);
+       QString qres;
+       if (fmt.empty())
+               qres = QLocale().toString(QDateTime::fromTime_t(t),
+                                         QLocale::ShortFormat);
+       else
+               qres = QLocale().toString(QDateTime::fromTime_t(t), toqstr(fmt));
+       return qstring_to_ucs4(qres);
 }