By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,706 Members | 1,298 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,706 IT Pros & Developers. It's quick & easy.

why goes the time change after import statement ?

P: n/a
hi i am working on a S3 project and facing a really weird problem!
take a look at the following import statements and the time output
>>import time
time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 20:21:56 GMT'

# OK
>>import pygtk
time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 20:22:04 GMT'

# OK
>>import gtk
time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 08:22:11 PM GMT'

# HOW THE HELL THIS HAPPEN ??? not DATE_RFC2822 format gmt time !

i have waisted 3 hours trying to locate the source of this strange
problem.
so what i am asking is does anyone know to overwrite or fix the
defaurl behaviour strftime() ????
Aug 2 '08 #1
Share this Question
Share on Google+
3 Replies

P: n/a
On Aug 2, 10:35*pm, binaryjesus <coolman.gu...@gmail.comwrote:
hi i am working on a S3 project and facing a really weird problem!
take a look at the following import statements and the time output
>import time
time.strftime("%a, %d %b %Y %X GMT", time.gmtime())

'Sat, 02 Aug 2008 20:21:56 GMT'

# OK
>import pygtk
time.strftime("%a, %d %b %Y %X GMT", time.gmtime())

'Sat, 02 Aug 2008 20:22:04 GMT'

# OK
>import gtk
time.strftime("%a, %d %b %Y %X GMT", time.gmtime())

'Sat, 02 Aug 2008 08:22:11 PM GMT'

# HOW THE HELL THIS HAPPEN ??? not DATE_RFC2822 format gmt time !
Reading the manual page for strftime -- http://docs.python.org/lib/module-time.html
-- says that '%X' is the locale's appropriate time representation, so
obviously gtk is adjusting your locale. Perhaps use a formatting
string that doesn't depend on the locale: '%H:%M:%S' instead of '%X'
seems to give your preferred format.

--
Paul Hankin
Aug 2 '08 #2

P: n/a
On Aug 3, 1:46 am, Paul Hankin <paul.han...@gmail.comwrote:
On Aug 2, 10:35 pm, binaryjesus <coolman.gu...@gmail.comwrote:
hi i am working on a S3 project and facing a really weird problem!
take a look at the following import statements and the time output
>>import time
>>time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 20:21:56 GMT'
# OK
>>import pygtk
>>time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 20:22:04 GMT'
# OK
>>import gtk
>>time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 08:22:11 PM GMT'
# HOW THE HELL THIS HAPPEN ??? not DATE_RFC2822 format gmt time !

Reading the manual page for strftime --http://docs.python.org/lib/module-time.html
-- says that '%X' is the locale's appropriate time representation, so
obviously gtk is adjusting your locale. Perhaps use a formatting
string that doesn't depend on the locale: '%H:%M:%S' instead of '%X'
seems to give your preferred format.

--
Paul Hankin
ok that explain it.
but what command does gtk runs that it sets the default behaviour of
strfime() to that ?
Aug 3 '08 #3

P: n/a
On Aug 3, 8:12*am, binaryjesus <coolman.gu...@gmail.comwrote:
On Aug 3, 1:46 am, Paul Hankin <paul.han...@gmail.comwrote:
On Aug 2, 10:35 pm, binaryjesus <coolman.gu...@gmail.comwrote:
hi i am working on a S3 project and facing a really weird problem!
take a look at the following import statements and the time output
>import time
>time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 20:21:56 GMT'
# OK
>import pygtk
>time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 20:22:04 GMT'
# OK
>import gtk
>time.strftime("%a, %d %b %Y %X GMT", time.gmtime())
'Sat, 02 Aug 2008 08:22:11 PM GMT'
# HOW THE HELL THIS HAPPEN ??? not DATE_RFC2822 format gmt time !
Reading the manual page for strftime --http://docs.python.org/lib/module-time.html
-- says that '%X' is the locale's appropriate time representation, so
obviously gtk is adjusting your locale. Perhaps use a formatting
string that doesn't depend on the locale: '%H:%M:%S' instead of '%X'
seems to give your preferred format.

ok that explain it.
but what command does gtk runs that it sets the default behaviour of
strfime() to that ?
Maybe setlocale?

--
Paul Hankin
Aug 3 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.