diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/util.cpp b/src/util.cpp index 1aba32b..27b2222 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2586,7 +2586,7 @@ QCString fileToString(const char *name,bool filter,bool isSourceCode) return ""; } -QCString dateToString(bool includeTime) +static QDateTime getCurrentDateTime() { QDateTime current = QDateTime::currentDateTime(); QCString sourceDateEpoch = portable_getenv("SOURCE_DATE_EPOCH"); @@ -2618,6 +2618,12 @@ QCString dateToString(bool includeTime) current.setTimeUtc_t((ulong)epoch); // TODO: add support for 64bit epoch value } } + return current; +} + +QCString dateToString(bool includeTime) +{ + const QDateTime current = getCurrentDateTime(); return theTranslator->trDateTime(current.date().year(), current.date().month(), current.date().day(), @@ -2630,9 +2636,9 @@ QCString dateToString(bool includeTime) QCString yearToString() { - const QDate &d=QDate::currentDate(); + const QDateTime current = getCurrentDateTime(); QCString result; - result.sprintf("%d", d.year()); + result.sprintf("%d", current.date().year()); return result; } |