As parse_date_or_fatal() currently uses atof(), which just returns 0
if the string isn't a valid number, it can never actually be fatal
and will just use "1970-01-01 00:00:00" as the time if the string is
specified wrong.
Fix that by using float() directly so ValueError() is raised.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
[rlb@defaultvalue.org: adjust commit summary]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
"""Parses the given date or calls Option.fatal().
For now we expect a string that contains a float."""
try:
- date = atof(str)
+ date = float(str)
except ValueError, e:
raise fatal('invalid date format (should be a float): %r' % e)
else: