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

datetime.utcfromtimestamp() converts time.time() to wrong datetime value in luigi.tools.range.RangeBase #3317

Open
wangzhe258369 opened this issue Oct 20, 2024 · 2 comments

Comments

@wangzhe258369
Copy link

datetime.utcfromtimestamp() is used in the source code, which converts time.time() or self.now parameter value to the wrong datetime instance.

now = datetime.utcfromtimestamp(time.time() if self.now is None else self.now)

now = datetime.utcfromtimestamp(time.time() if self.now is None else self.now)

It should be:

now = datetime.fromtimestamp(time.time() if self.now is None else self.now)
@VishalGawade1
Copy link

Hey @RRap0so!

I would like to contribute on this. I saw the issue with datetime.utcfromtimestamp() giving the wrong time. I think switching it to datetime.fromtimestamp() could fix it and return the correct local time.

Let me know!

@dlstadther
Copy link
Collaborator

This bit of code has existed in the repo for 10 years now. The case where this would produce unexpected results is when this section of code is used on a system which has its time set to a non-UTC timezone.

I'm not saying this shouldn't be addressed, but we should be careful to think through what impact this could have if changes to either handle UTC or to handle local tz.

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