Ticket #16924: patch.diff
File patch.diff, 1.0 KB (added by , 13 years ago) |
---|
-
django/utils/dateformat.py
14 14 import re 15 15 import time 16 16 import calendar 17 import math 17 18 from django.utils.dates import MONTHS, MONTHS_3, MONTHS_ALT, MONTHS_AP, WEEKDAYS, WEEKDAYS_ABBR 18 19 from django.utils.tzinfo import LocalTimezone 19 20 from django.utils.translation import ugettext as _ … … 182 183 return MONTHS_AP[self.data.month] 183 184 184 185 def O(self): 185 "Difference to Greenwich time in hours; e.g. '+0200' "186 "Difference to Greenwich time in hours; e.g. '+0200', '-0330'" 186 187 seconds = self.Z() 187 return u"%+03d%02d" % (seconds // 3600, (seconds // 60) % 60) 188 hour = math.copysign(abs(seconds) // 3600, seconds) 189 minute = (abs(seconds) // 60) % 60 190 return u"%+03d%02d" % (hour, minute) 188 191 189 192 def r(self): 190 193 "RFC 2822 formatted date; e.g. 'Thu, 21 Dec 2000 16:01:07 +0200'"