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

[utils] Fix time_seconds to use the provided TZ #6118

Merged
merged 3 commits into from
Jan 31, 2023

Conversation

Lesmiscore
Copy link
Contributor

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

Fixes #6056

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check one of the following options:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

#6056 (comment)

What is the purpose of your pull request?

@Grub4K
Copy link
Member

Grub4K commented Jan 30, 2023

.timestamp() does not respect the timezone offset, but how about just manually adding the offset to time.time?

def time_seconds(**kwargs):
    return time.time() + datetime.timedelta(**kwargs).total_seconds()

Maybe im misunderstanding what this function is trying to do? In my testing this yields the same results as your function. The old function just ignores the timezone offset.

@Lesmiscore
Copy link
Contributor Author

That looks correct, how come didn't I come up with it

@pukkandan
Copy link
Member

The docstring from the previous commit is useful

@pukkandan pukkandan added the bug Bug that is not site-specific label Jan 31, 2023
@Lesmiscore Lesmiscore changed the title [utils] Fix time_seconds [utils] Fix time_seconds to use the provided TZ Jan 31, 2023
@Lesmiscore Lesmiscore merged commit 83c4970 into yt-dlp:master Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is not site-specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants