Fix issues with year 2038 (#3052)
* Fix annotations in year 2038 Fixes #3050 * Ensure 32-bit systems work better after 2038 Without this patch, their 32-bit signed long int could overflow. This patch was done while working on reproducible builds for openSUSE.
This commit is contained in:
committed by
GitHub
parent
7017d8fc31
commit
603bf075f1
@@ -199,8 +199,8 @@ const std::string Task::identifier (bool shortened /* = false */) const
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Task::setAsNow (const std::string& att)
|
||||
{
|
||||
char now[16];
|
||||
snprintf (now, 16, "%u", (unsigned int) time (nullptr));
|
||||
char now[22];
|
||||
snprintf (now, 22, "%lli", (long long int) time (nullptr));
|
||||
set (att, now);
|
||||
|
||||
recalc_urgency = true;
|
||||
@@ -1189,7 +1189,7 @@ void Task::addAnnotation (const std::string& description)
|
||||
|
||||
do
|
||||
{
|
||||
key = "annotation_" + format ((int) now);
|
||||
key = "annotation_" + format ((long long int) now);
|
||||
++now;
|
||||
}
|
||||
while (has (key));
|
||||
|
||||
Reference in New Issue
Block a user