This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年01月09日 17:15 by techtonik, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (11) | |||
|---|---|---|---|
| msg97463 - (view) | Author: anatoly techtonik (techtonik) | Date: 2010年01月09日 17:15 | |
The proposal to add the function that will allow to get current UTC offset. Do we need a PEP for this one? def time.utcoffset(): """Return current UTC offset in seconds""" return -(time.altzone if time.daylight else time.timezone) |
|||
| msg97472 - (view) | Author: Brian Curtin (brian.curtin) * (Python committer) | Date: 2010年01月09日 21:26 | |
I think this would be nice, but see msg97471 from your diff.py ISO timestamp issue. time.daylight should probably be time.localtime().tm_isdst. |
|||
| msg97509 - (view) | Author: anatoly techtonik (techtonik) | Date: 2010年01月10日 11:45 | |
Answered in msg97503 In the meanwhile it looks like another proposal about RFC format in issue #7584 doesn't account for proper timezone too. |
|||
| msg99119 - (view) | Author: anatoly techtonik (techtonik) | Date: 2010年02月09日 14:56 | |
Updated Python code according to discussion from aforementioned issue #7582. Unfortunately, I can't find Python source for `time` module to make a proper patch out of it. def time.utcoffset(): """Return current UTC offset in seconds""" isdst = time.localtime().tm_isdst if (time.daylight and isdst): return -time.altzone else: return -time.timezone |
|||
| msg99120 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年02月09日 15:48 | |
The `time` module is written in C, in Modules/timemodule.c. If this is too bothersome to write in C, the function could perhaps be added to the datetime module instead. In any case, we need a proper patch, including unit tests if possible. (and I agree that anything making the time stuff easier to use is welcome) |
|||
| msg107172 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2010年06月06日 01:52 | |
I would prefer exposing tm_gmtoff in time.localtime() output. The advantage is that on platforms that support it is struct tm, it will return correct offset for times in the past, not only for the current time. See issue1647654. On platforms without tm_gmtoff we can fill it with -tm_isdst?timezone:altzone. The current situation on Linux is just backwards: we are trying to divine altzone by sampling tm_gmtoff and throw tm_gmtoff away. See http://blogs.gnome.org/jamesh/2006/12/31/python-timetimezone-timealtzone-edge-case/. |
|||
| msg126064 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2011年01月12日 01:44 | |
I am going to close this as superseded by #9527. All these issues, current, #9527, and #1647654 are really about Python's lack of access to the system timezone information and #9527 seem to be the most appropriate solution. My specific concern about proposed time.utcoffset() is that you normally need UTC offset together with current time, but localtime() call followed by utcoffset() may lead to a race condition. |
|||
| msg126217 - (view) | Author: anatoly techtonik (techtonik) | Date: 2011年01月13日 23:27 | |
This one is a different issue. Even though it can not be solved without by #9527, it is not superseded by it. So, better add to dependencies. |
|||
| msg126218 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2011年01月13日 23:39 | |
You can discuss within the comments whether this issue should be re-opened or not, but do not take it upon yourself to change the status on your own once a core developer has already closed an issue as their decision supersedes that of a regular user. |
|||
| msg126220 - (view) | Author: anatoly techtonik (techtonik) | Date: 2011年01月14日 00:18 | |
I am tired. Do as you wish. |
|||
| msg126224 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2011年01月14日 04:25 | |
Just to clarify: Anatoly changed the resolution, not status (and I agree that was not appropriate.) The status was set to "pending" and that would change to "open" automatically if a new comment is posted. As for the substance of Anatoly's objection - I agree that this proposal is different from #9527. That is why I set resolution to "rejected" rathe than "duplicate". This issue can probably be properly classified as a duplicate of #1647654, but I consider #9527 the most promising solution to the problem of finding the system timezone offset. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:56 | admin | set | github: 51911 |
| 2011年01月14日 04:25:28 | belopolsky | set | nosy:
belopolsky, pitrou, eric.araujo messages: + msg126224 stage: needs patch -> resolved |
| 2011年01月14日 00:19:03 | techtonik | set | nosy:
- techtonik |
| 2011年01月14日 00:18:42 | techtonik | set | status: open -> closed nosy: belopolsky, pitrou, techtonik, eric.araujo messages: + msg126220 |
| 2011年01月13日 23:39:30 | brett.cannon | set | status: pending -> open nosy: - brett.cannon |
| 2011年01月13日 23:39:17 | brett.cannon | set | status: open -> pending messages: + msg126218 resolution: rejected nosy: brett.cannon, belopolsky, pitrou, techtonik, eric.araujo |
| 2011年01月13日 23:29:14 | brian.curtin | set | nosy:
- brian.curtin |
| 2011年01月13日 23:27:56 | techtonik | set | status: pending -> open messages: + msg126217 resolution: rejected -> (no value) nosy: brett.cannon, belopolsky, pitrou, techtonik, eric.araujo, brian.curtin |
| 2011年01月12日 01:44:32 | belopolsky | set | status: open -> pending superseder: Add aware local time support to datetime module messages: + msg126064 nosy: brett.cannon, belopolsky, pitrou, techtonik, eric.araujo, brian.curtin resolution: rejected |
| 2010年12月01日 19:01:00 | eric.araujo | set | nosy:
+ eric.araujo versions: + Python 3.3, - Python 2.7, Python 3.2 |
| 2010年06月06日 01:52:05 | belopolsky | set | assignee: belopolsky messages: + msg107172 nosy: + belopolsky |
| 2010年02月09日 15:48:15 | pitrou | set | nosy:
+ brett.cannon, pitrou messages: + msg99120 |
| 2010年02月09日 14:56:34 | techtonik | set | messages: + msg99119 |
| 2010年01月14日 02:41:01 | brian.curtin | set | priority: normal stage: needs patch |
| 2010年01月10日 11:45:56 | techtonik | set | messages: + msg97509 |
| 2010年01月09日 21:26:54 | brian.curtin | set | versions:
- Python 3.1 nosy: + brian.curtin messages: + msg97472 type: enhancement |
| 2010年01月09日 17:30:54 | techtonik | set | title: time.utcoffset(dst=true) -> time.utcoffset() |
| 2010年01月09日 17:15:39 | techtonik | create | |