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.utctimetuple() method should respect fold disambiguation #71898

Closed
abalkin opened this issue Aug 8, 2016 · 2 comments
Closed

datetime.utctimetuple() method should respect fold disambiguation #71898

abalkin opened this issue Aug 8, 2016 · 2 comments
Assignees
Labels
type-feature A feature request or enhancement

Comments

@abalkin
Copy link
Member

abalkin commented Aug 8, 2016

BPO 27711
Nosy @abalkin

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/abalkin'
closed_at = <Date 2016-08-08.16:21:37.726>
created_at = <Date 2016-08-08.16:18:06.134>
labels = ['type-feature']
title = 'datetime.utctimetuple() method should respect fold disambiguation'
updated_at = <Date 2016-08-08.16:21:37.725>
user = 'https://github.com/abalkin'

bugs.python.org fields:

activity = <Date 2016-08-08.16:21:37.725>
actor = 'belopolsky'
assignee = 'belopolsky'
closed = True
closed_date = <Date 2016-08-08.16:21:37.726>
closer = 'belopolsky'
components = []
creation = <Date 2016-08-08.16:18:06.134>
creator = 'belopolsky'
dependencies = []
files = []
hgrepos = []
issue_num = 27711
keywords = []
message_count = 2.0
messages = ['272175', '272176']
nosy_count = 1.0
nosy_names = ['belopolsky']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue27711'
versions = ['Python 3.6']

@abalkin
Copy link
Member Author

abalkin commented Aug 8, 2016

With TZ = America/New_York:

>>> t0 = datetime(2016, 11, 6, 1, 30, fold=0)
>>> t1 = datetime(2016, 11, 6, 1, 30, fold=1)
>>> t0.utctimetuple()[:6]
(2016, 11, 6, 1, 30, 0)
>>> t1.utctimetuple()[:6]
(2016, 11, 6, 1, 30, 0)
>>> t0.timestamp()
1478410200.0
>>> t1.timestamp()
1478413800.0

The correct values for utctimetuple() should be the same as

>>> datetime.utcfromtimestamp(t0.timestamp()).timetuple()[:6]
(2016, 11, 6, 5, 30, 0)
>>> datetime.utcfromtimestamp(t1.timestamp()).timetuple()[:6]
(2016, 11, 6, 6, 30, 0)

@abalkin abalkin added the type-bug An unexpected behavior, bug, or error label Aug 8, 2016
@abalkin abalkin self-assigned this Aug 8, 2016
@abalkin
Copy link
Member Author

abalkin commented Aug 8, 2016

This would be a feature not anticipated by PEP-495.

@abalkin abalkin closed this as completed Aug 8, 2016
@abalkin abalkin added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Aug 8, 2016
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant