Bruno Haible wrote:
Looking at wikipedia [1], I would find it good if
1) the function was called 'parse_duration', not 'parse_time' (since "time"
often denotes a time instant within a day),
2) the three duration formats described in [1] were also support
> 3? I only see one, though with lots of optional fields.
I meant the three: PnYnMnDTnHnMnS, PnW, and PT.
> That format also doesn't allow for visual space.
Yes, it's more meant for durations that are exchanged between software,
not entered by humans.
> The little question remaining though is
ong should I wait" option. Though "timeout" only accepts it as
an operand.
> Looking at wikipedia [1], I would find it good if
> 1) the function was called 'parse_duration', not 'parse_time' (since "time"
> often denotes a time instant wit
t good if
1) the function was called 'parse_duration', not 'parse_time' (since "time"
often denotes a time instant within a day),
2) the three duration formats described in [1] were also supported.
Bruno
[1] http://en.wikipedia.org/wiki/ISO_8601#Durations
errno = EINVAL;
return ~0;
}
return start;
}
time_t
parse_time(char const * in_pz)
{
whats_done_t whatd_we_do = NOTHING_IS_DONE;
char * pz;
time_t val;
time_t res = 0;
while (isspace(*in_pz)) in_pz++;
if (! isdigit((int)*in_pz)) goto bad_time;
do {
err