Menu

#1 parse time is depend of system timezone

open
nobody
Problem (1)
5
2007-02-22
2007-02-21
No

I begin to report problem on python
(https://sourceforge.net/tracker/index.php?func=detail&aid=1656559&group_id=5470&atid=105470)

but this is a specif of file ./site-packages/_xmlplus/utils/iso8601.py

gmt = __extract_date(m) + __extract_time(m) + (0, 0, 0) this is wrong
My sugestion is:
gmt = __extract_date(m) + __extract_time(m)
gmt = datetime(gmt).timetuple()

(0,0,0) zero for week of day, zero for day of the year and zero isdst is the error here.

timetuple calculate this last 3 numbers well.
and my problem is gone !

references http://docs.python.org/lib/module-time.html:
0 tm_year (for example, 1993)
1 tm_mon range [1,12]
2 tm_mday range [1,31]
3 tm_hour range [0,23]
4 tm_min range [0,59]
5 tm_sec range [0,61]; see (1) in strftime() description
6 tm_wday range [0,6], Monday is 0
7 tm_yday range [1,366]
8 tm_isdst 0, 1 or -1; see below

Discussion

  • Sérgio M. Basto

    Logged In: YES
    user_id=4882
    Originator: YES

    Please forget my last comment it is all wrong.
    finally I resolve my problem

    instead return time.mktime which is timezone system depend
    return time.mktime(gmt) + __extract_tzd(m) - time.timezone

    I use calendar.timegm which isn't
    return calendar.timegm(gmt) + __extract_tzd(m) - time.timezone

     
  • Sérgio M. Basto

    • summary: parse time problem --> parse time is depend of system timezone
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.