time.strftime BUG? 
Author Message
 time.strftime BUG?

Hello,

I have found that on my system (Linux RH6.2+, glibc-2.1.3)
strftime shows me the following:

Quote:
>>> import time
>>> time.strftime("%Z", time.localtime(time.time()))
'MSD'
>>> time.strftime("%z", time.localtime(time.time()))

'+0000'

While I believe the later should be:
'+0400'

At the same time:

$ date +%z
+0400

which looks reasonable. What is wrong?

Sincerely yours, Roman Suzi
--

_/ Saturday, July 07, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "OK, I'm weird! But I'm saving up to become eccentric." _/



Wed, 24 Dec 2003 15:34:03 GMT  
 time.strftime BUG?

Quote:

> >>> time.strftime("%Z", time.localtime(time.time()))
> 'MSD'
> >>> time.strftime("%z", time.localtime(time.time()))
> '+0000'
> While I believe the later should be:
> '+0400'

I'm a bit confused by this too.

ratchet% python
Python 2.1 (#7, Jun 24 2001, 18:32:35)
[GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2
Type "copyright", "credits" or "license" for more information.

Quote:
>>> import time
>>> time.strftime("%z")      
'+0100'
>>> time.strftime("%z", time.localtime(time.time()))

'+0000'

What gets me is that (according to the way I read them) the docs say
the two satements above should return the same thing.

  strftime(format[, tuple]) -> string

  Convert a time tuple to a string according to a format specification.
  See the library reference manual for formatting codes. When the time
  tuple is not present, current time as returned by localtime() is used.

--
Graham



Fri, 26 Dec 2003 06:31:53 GMT  
 time.strftime BUG?

I've reported this BUG thru Sourceforge.

Quote:


>> >>> time.strftime("%Z", time.localtime(time.time()))
>> 'MSD'
>> >>> time.strftime("%z", time.localtime(time.time()))
>> '+0000'

>> While I believe the later should be:
>> '+0400'

>I'm a bit confused by this too.

Sincerely yours, Roman Suzi
--

_/ Monday, July 09, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Useless Invention: Motorcycle seat-belts." _/


Fri, 26 Dec 2003 12:55:40 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. bug in time.strftime on linux???

2. unix time and strftime

3. time.strftime()

4. Bug in time.c (was Time.times problems)

5. time and scheduling (was: bug report: [ #447945 ] time.time() is not non-decreasing)

6. bug report: [ #447945 ] time.time() is not non-decreasing

7. bug report: [ #447945 ] time.time() is not non-decreasing

8. GAWK: strftime("%z") and portability (which version of strftime is used in compile?)

9. BUGS, BUGS, BUGS, BUGS, C4 BUGS

10. Localized strftime() output

11. strftime * date calculations

12. Q: inverse of strftime

 

 
Powered by phpBB® Forum Software