Recurrence: Duration replaced by ISO8601p
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
#include <Date.h>
|
#include <Date.h>
|
||||||
#include <Duration.h>
|
#include <ISO8601.h>
|
||||||
#include <Lexer.h>
|
#include <Lexer.h>
|
||||||
#include <ISO8601.h>
|
#include <ISO8601.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
@@ -368,27 +368,14 @@ Date getNextRecurrence (Date& current, std::string& period)
|
|||||||
return Date (m, d, y);
|
return Date (m, d, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the period is an 'easy' one, add it to current, and we're done.
|
// Add the period to current, and we're done.
|
||||||
// If it throws an error, the duration was not recognized.
|
|
||||||
int secs = 0;
|
int secs = 0;
|
||||||
std::string::size_type idx = 0;
|
std::string::size_type idx = 0;
|
||||||
Duration du;
|
ISO8601p p;
|
||||||
if (du.parse (period, idx))
|
if (! p.parse (period, idx))
|
||||||
{
|
throw std::string (format (STRING_TASK_VALID_RECUR, period));
|
||||||
secs = du;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
idx = 0;
|
|
||||||
ISO8601p p;
|
|
||||||
if (p.parse (period, idx))
|
|
||||||
{
|
|
||||||
secs = p;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw std::string (format (STRING_TASK_VALID_RECUR, period));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
secs = (time_t) p;
|
||||||
return current + secs;
|
return current + secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user