Recurrence: Converted from sprintf to std::to_string

This commit is contained in:
Paul Beckingham 2015-11-01 18:49:11 -05:00
parent f339672b89
commit b4035d6ff5

View file

@ -97,18 +97,14 @@ void handleRecurrence ()
rec.set ("uuid", uuid ()); // New UUID.
rec.set ("parent", t.get ("uuid")); // Remember mom.
rec.setAsNow ("entry"); // New entry date.
char dueDate[16];
sprintf (dueDate, "%u", (unsigned int) d.toEpoch ());
rec.set ("due", dueDate); // Store generated due date.
rec.set ("due", std::to_string (d.toEpoch ()));
if (t.has ("wait"))
{
ISO8601d old_wait (t.get_date ("wait"));
ISO8601d old_due (t.get_date ("due"));
ISO8601d due (d);
sprintf (dueDate, "%u", (unsigned int) (due + (old_wait - old_due)).toEpoch ());
rec.set ("wait", dueDate);
rec.set ("wait", std::to_string ((due + (old_wait - old_due)).toEpoch ()));
rec.setStatus (Task::waiting);
mask += 'W';
}
@ -118,10 +114,7 @@ void handleRecurrence ()
rec.setStatus (Task::pending);
}
char indexMask[12];
sprintf (indexMask, "%u", (unsigned int) i);
rec.set ("imask", indexMask); // Store index into mask.
rec.set ("imask", i);
rec.remove ("mask"); // Remove the mask of the parent.
// Add the new task to the DB.