classification
Title: time.asctime_tz, time.strftime %z %C
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: rejected
Dependencies: Superseder: Add aware local time support to datetime module
View: 9527
Assigned To: belopolsky Nosy List: ajaksu2, belopolsky, kxroberto
Priority: normal Keywords:

Created on 2006-04-24 09:40 by kxroberto, last changed 2011-04-07 19:56 by belopolsky. This issue is now closed.

Messages (4)
msg61229 - (view) Author: kxroberto (kxroberto) Date: 2006-04-24 09:40
Very often I need (for logging purposes, legal
international action confirmation display, ...) quickly
a stable/constant/technical/international timezone info
in addition to %c / .asctime.  And find me regularly
checking if the computer/server displays %Z nice,
writing 10-liner funcs ...

found %z by trial (and in footnote)

yet time.strftime('%c %z') flickers (on Windows..)

think, %z can be computed very easily independent of OS
libs? time.altzone /% 3600 ... ==> "+/-HHMM" ?

that could be doc'ed.

( the sign of  time.timezone / time.altzone is
unfortunately revers of RFC standardds , yet its ok
doced. there should be a function/update-function for
long running apps also ? )

then .asctime_tz() would be very nice to find it in the
docs.  (and maybe asctime_TZ)

-robert
msg83911 - (view) Author: Daniel Diniz (ajaksu2) (Python triager) Date: 2009-03-21 02:22
Could you provide a test case and clearer description of your feature
request?
msg83928 - (view) Author: kxroberto (kxroberto) Date: 2009-03-21 09:55
(I'm somewhat away from all that currently - and not aware if newest
Python versions already solved but:)

* a "time.asctime_tz([tim])" or so should deliver a full OS-indep.
_world_ time string incl. numeric timezone info like 
"Sat Mar 21 10:33:36 2009 +0000"
It should accept a 10-tuple (like urlopen_file.info().getdate_tz('date'),
or a time.time() float time, 
or interpret a 9-tuple as GMTIME/UTC.

* strftime("%z") should be supported on all OS - _constant numeric_
format "+0000" 

* strftime("%C",[tim]) should be like asctime_tz.
  it should accept as 2nd parameter a 10-tuple alternatively, 
  or a time.time() universal float time, 
  or interpret the 9-tuple as LOCALTIME as it were.

test cases to add: 
* simple render a variation of constant tuples/float_times to constant
result strings.
msg116304 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-09-13 13:46
Would issue9527 address your request?  Note that datetime.strftime already supports %z:

>>> from datetime import *
>>> datetime.now(timezone.utc).strftime('%c %z')
'Mon Sep 13 13:43:19 2010 +0000'

(I assume you meant to write %c, not %C.)
History
Date User Action Args
2011-04-07 19:56:22belopolskysetstatus: pending -> closed
dependencies: - Add aware local time support to datetime module
2011-01-08 06:17:14belopolskysetstatus: open -> pending
nosy: belopolsky, kxroberto, ajaksu2
superseder: Add aware local time support to datetime module
resolution: rejected
stage: test needed -> resolved
2010-09-13 13:46:05belopolskysetassignee: belopolsky
dependencies: + Add aware local time support to datetime module
messages: + msg116304
2010-08-09 03:28:19terry.reedysetnosy: + belopolsky

versions: + Python 3.2, - Python 3.1, Python 2.7
2009-03-21 09:58:25kxrobertosettitle: compute/doc %z os-indep., time.asctime_tz / _TZ -> time.asctime_tz, time.strftime %z %C
2009-03-21 09:55:34kxrobertosetmessages: + msg83928
2009-03-21 02:22:44ajaksu2setversions: + Python 3.1, Python 2.7
nosy: + ajaksu2

messages: + msg83911

stage: test needed
2006-04-24 09:40:31kxrobertocreate