summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-10-28 18:33:00 (GMT)
committerGitHub <noreply@github.com>2019-10-28 18:33:00 (GMT)
commit43ebd07c14549b20d51133dfe6fb3d1ba84d42a5 (patch)
tree0ac8ed9c8cbfebf13252343761aa380c89b9d309 /src/util.cpp
parent292838b0073a24350f70cc00aa449721f781c8fa (diff)
parentc993785c8cae4712cd6fd34004c02041a128d7c7 (diff)
downloadDoxygen-43ebd07c14549b20d51133dfe6fb3d1ba84d42a5.zip
Doxygen-43ebd07c14549b20d51133dfe6fb3d1ba84d42a5.tar.gz
Doxygen-43ebd07c14549b20d51133dfe6fb3d1ba84d42a5.tar.bz2
Merge pull request #7341 from ellert/source-date-year
Let $year support SOURCE_DATE_EPOCH
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp12
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;
}