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