Ticket #2633: tmp_fix.diff

File tmp_fix.diff, 1.5 KB (added by wbyoung@…, 17 years ago)
  • django/utils/dateformat.py

     
    165165    def O(self):
    166166        "Difference to Greenwich time in hours; e.g. '+0200'"
    167167        tz = self.timezone.utcoffset(self.data)
    168         return "%+03d%02d" % (tz.seconds // 3600, (tz.seconds // 60) % 60)
     168        seconds = tz.days * 86400 + tz.seconds
     169        return "%+03d%02d" % (seconds // 3600, (seconds // 60) % 60)
    169170
    170171    def r(self):
    171172        "RFC 822 formatted date; e.g. 'Thu, 21 Dec 2000 16:01:07 +0200'"
     
    198199    def U(self):
    199200        "Seconds since the Unix epoch (January 1 1970 00:00:00 GMT)"
    200201        off = self.timezone.utcoffset(self.data)
    201         return int(time.mktime(self.data.timetuple())) + off.seconds * 60
     202        seconds = off.days * 86400 + off.seconds
     203        return int(time.mktime(self.data.timetuple())) + seconds * 60
    202204
    203205    def w(self):
    204206        "Day of the week, numeric, i.e. '0' (Sunday) to '6' (Saturday)"
     
    249251        """Time zone offset in seconds (i.e. '-43200' to '43200'). The offset
    250252        for timezones west of UTC is always negative, and for those east of UTC
    251253        is always positive."""
    252         return self.timezone.utcoffset(self.data).seconds
     254        off = self.timezone.utcoffset(self.data)
     255        return off.days * 86400 + off.seconds
    253256
    254257def format(value, format_string):
    255258    "Convenience function"
Back to Top