Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow time to be given as float #40

Closed
alistairking opened this issue Feb 8, 2021 · 2 comments
Closed

Allow time to be given as float #40

alistairking opened this issue Feb 8, 2021 · 2 comments

Comments

@alistairking
Copy link
Member

Currently the datetime parsing code at

def _datestr_to_epoch(datestr):
if datestr is None:
return 0
if isinstance(datestr, int):
return datestr
assert (isinstance(datestr, str))
if datestr.isdigit():
return int(datestr)
dt = dateutil.parser.parse(datestr, ignoretz=True)
return int((dt - datetime.datetime(1970, 1, 1)).total_seconds())

triggers an assertion if the given time is a float (as is the case when passing time.time()).

@digizeph
Copy link
Contributor

digizeph commented Feb 9, 2021

@alistairking I added the support for floating number timestamps in PR #41, could you take a look?

@brendonj
Copy link
Contributor

#41 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants