Revert "Revert "Extend timerange to support unxtime""
This reverts commit bc3d4518ff
.
This commit is contained in:
parent
bc3d4518ff
commit
b54e6c5af0
@ -222,6 +222,9 @@ class Arguments(object):
|
|||||||
syntax = [(r'^-(\d{8})$', (None, 'date')),
|
syntax = [(r'^-(\d{8})$', (None, 'date')),
|
||||||
(r'^(\d{8})-$', ('date', None)),
|
(r'^(\d{8})-$', ('date', None)),
|
||||||
(r'^(\d{8})-(\d{8})$', ('date', 'date')),
|
(r'^(\d{8})-(\d{8})$', ('date', 'date')),
|
||||||
|
(r'^-(\d{10})$', (None, 'timestamp')),
|
||||||
|
(r'^(\d{10})-$', ('timestamp', None)),
|
||||||
|
(r'^(\d{10})-(\d{10})$', ('timestamp', 'timestamp')),
|
||||||
(r'^(-\d+)$', (None, 'line')),
|
(r'^(-\d+)$', (None, 'line')),
|
||||||
(r'^(\d+)-$', ('line', None)),
|
(r'^(\d+)-$', ('line', None)),
|
||||||
(r'^(\d+)-(\d+)$', ('index', 'index'))]
|
(r'^(\d+)-(\d+)$', ('index', 'index'))]
|
||||||
@ -237,6 +240,8 @@ class Arguments(object):
|
|||||||
start = rvals[index]
|
start = rvals[index]
|
||||||
if stype[0] == 'date':
|
if stype[0] == 'date':
|
||||||
start = arrow.get(start, 'YYYYMMDD').timestamp
|
start = arrow.get(start, 'YYYYMMDD').timestamp
|
||||||
|
elif stype[0] == 'timestamp':
|
||||||
|
start = arrow.get(start).timestamp
|
||||||
else:
|
else:
|
||||||
start = int(start)
|
start = int(start)
|
||||||
index += 1
|
index += 1
|
||||||
@ -244,6 +249,8 @@ class Arguments(object):
|
|||||||
stop = rvals[index]
|
stop = rvals[index]
|
||||||
if stype[1] == 'date':
|
if stype[1] == 'date':
|
||||||
stop = arrow.get(stop, 'YYYYMMDD').timestamp
|
stop = arrow.get(stop, 'YYYYMMDD').timestamp
|
||||||
|
elif stype[1] == 'timestamp':
|
||||||
|
stop = arrow.get(stop).timestamp
|
||||||
else:
|
else:
|
||||||
stop = int(stop)
|
stop = int(stop)
|
||||||
return stype, start, stop
|
return stype, start, stop
|
||||||
|
Loading…
Reference in New Issue
Block a user