|
|
@@ -65,6 +65,14 @@ def parse_time(toparse): |
|
|
|
if toparse == "max": |
|
|
|
return max_timestamp |
|
|
|
|
|
|
|
# If it starts with @, treat it as a NILM timestamp |
|
|
|
# (integer microseconds since epoch) |
|
|
|
try: |
|
|
|
if toparse[0] == '@': |
|
|
|
return int(toparse[1:]) |
|
|
|
except (ValueError, KeyError): |
|
|
|
pass |
|
|
|
|
|
|
|
# If string isn't "now" and doesn't contain at least 4 digits, |
|
|
|
# consider it invalid. smartparse might otherwise accept |
|
|
|
# empty strings and strings with just separators. |
|
|
@@ -78,14 +86,6 @@ def parse_time(toparse): |
|
|
|
except (ValueError, OverflowError): |
|
|
|
pass |
|
|
|
|
|
|
|
# If it starts with @, treat it as a NILM timestamp |
|
|
|
# (integer microseconds since epoch) |
|
|
|
try: |
|
|
|
if toparse[0] == '@': |
|
|
|
return int(toparse[1:]) |
|
|
|
except (ValueError, KeyError): |
|
|
|
pass |
|
|
|
|
|
|
|
# If it's parseable as a float, treat it as a Unix or NILM |
|
|
|
# timestamp based on its range. |
|
|
|
try: |
|
|
|