Author belopolsky
Recipients belopolsky
Date 2010-08-06.03:48:16
SpamBayes Score 1.04265e-10
Marked as misclassified No
Message-id <>
See python-dev post for motivation.

I am attaching a patch implementing the proposed method in  I will also paste the code below.  Note that this is only prototype.  Real implementation will use tm_zone and tm_gmtoff components of tm structure on platforms that supply them.

    def localtime(cls, t=None, isdst=-1):
        """Return local time as an aware datetime object.                                                                                                          
        If called without arguments, return current time.  Otherwise                                                                                               
        *t* is converted to local time zone according to the system                                                                                                
        time zone database.  If *t* is naive (i.e. t.tzinfo is None),                                                                                              
        it is assumed to be in local time.  In this case, a positive or                                                                                            
        zero value for *isdst* causes localtime to presume initially                                                                                               
        that summer time (for example, Daylight Saving Time) is or is                                                                                              
        not (respectively) in effect for the specified time.  A                                                                                                    
        negative value for *isdst* causes the localtime() function to                                                                                              
        attempt to divine whether summer time is in effect for the                                                                                                 
        specified time.                                                                                                                                            
        if t is None:
            t = _time.time()
            if t.tzinfo is None:
                tm = t.timetuple()[:-1] + (isdst,)
                t = _time.mktime(tm)
                delta = t - datetime(1970, 1, 1, tzinfo=timezone.utc)
                t = delta.total_seconds()
        tm = _time.localtime(t)
        if _time.daylight:
            if tm.tm_isdst:
                offset = _time.altzone
                tzname = _time.tzname[1]
                offset = _time.timezone
                tzname = _time.tzname[0]
        tz = timezone(timedelta(seconds=-offset), tzname)
        return cls.fromtimestamp(t, tz)
Date User Action Args
2010-08-06 03:48:20belopolskysetrecipients: + belopolsky
2010-08-06 03:48:20belopolskysetmessageid: <>
2010-08-06 03:48:18belopolskylinkissue9527 messages
2010-08-06 03:48:17belopolskycreate