Skip to content

Commit c993785

Browse files
committed
Let $year support SOURCE_DATE_EPOCH
1 parent d0d748a commit c993785

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/util.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,7 +2590,7 @@ QCString fileToString(const char *name,bool filter,bool isSourceCode)
25902590
return "";
25912591
}
25922592

2593-
QCString dateToString(bool includeTime)
2593+
static QDateTime getCurrentDateTime()
25942594
{
25952595
QDateTime current = QDateTime::currentDateTime();
25962596
QCString sourceDateEpoch = portable_getenv("SOURCE_DATE_EPOCH");
@@ -2622,6 +2622,12 @@ QCString dateToString(bool includeTime)
26222622
current.setTimeUtc_t((ulong)epoch); // TODO: add support for 64bit epoch value
26232623
}
26242624
}
2625+
return current;
2626+
}
2627+
2628+
QCString dateToString(bool includeTime)
2629+
{
2630+
const QDateTime current = getCurrentDateTime();
26252631
return theTranslator->trDateTime(current.date().year(),
26262632
current.date().month(),
26272633
current.date().day(),
@@ -2634,9 +2640,9 @@ QCString dateToString(bool includeTime)
26342640

26352641
QCString yearToString()
26362642
{
2637-
const QDate &d=QDate::currentDate();
2643+
const QDateTime current = getCurrentDateTime();
26382644
QCString result;
2639-
result.sprintf("%d", d.year());
2645+
result.sprintf("%d", current.date().year());
26402646
return result;
26412647
}
26422648

0 commit comments

Comments
 (0)