From: davyd Date: Sat, 7 Feb 2004 17:12:19 +0000 (+0000) Subject: final tz fixes, seems sane now X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=18f48e511713b1d2d168585d656ebfe5f7c0f2ea;p=planet-ucc.git final tz fixes, seems sane now --- diff --git a/XMLParse.py b/XMLParse.py index 7ca0f93..a50925f 100644 --- a/XMLParse.py +++ b/XMLParse.py @@ -90,7 +90,7 @@ class RDFParse: elif node2.nodeType == 1 and node2.tagName == 'dc:date': date = self.__retrieve_value__(node2) try: - item.itemDate = time.mktime(time.strptime(date, '%Y-%m-%dT%H:%M:%S+07:00')) + item.itemDate = time.mktime(time.strptime(date, '%Y-%m-%dT%H:%M:%S+07:00')) + 3600 except: sys.stderr.write("DEBUG: RDFParse: time string %s unparseable\n" % date) elif node2.nodeType == 1 and node2.tagName == 'description': @@ -121,10 +121,10 @@ class RSS2Parse: item.itemTitle = self.__retrieve_value__(node) elif node.nodeType == 1 and node.tagName == 'pubDate': try: - item.itemDate = time.mktime(time.strptime(self.__retrieve_value__(node), '%a, %d %b %Y %H:%M:%S %Z')) + item.itemDate = time.mktime(time.strptime(self.__retrieve_value__(node), '%a, %d %b %Y %H:%M:%S GMT')) + 28800 except: try: - item.itemDate = time.mktime(time.strptime(self.__retrieve_value__(node), '%a, %d %b %Y %H:%M:%S +0000')) + item.itemDate = time.mktime(time.strptime(self.__retrieve_value__(node), '%a, %d %b %Y %H:%M:%S +0000')) + 28800 except: sys.stderr.write("DEBUG: RSS2Parse: time string %s unparseable\n" % self.__retrieve_value__(node)) elif node.nodeType == 1 and node.tagName == 'link': diff --git a/XMLWriter.py b/XMLWriter.py index 5b0582e..6f39119 100644 --- a/XMLWriter.py +++ b/XMLWriter.py @@ -60,8 +60,8 @@ class Planet: if lastItem == None: break # this checks to see if it's a new day - if time.gmtime(lastItem.itemDate)[6] != lastDate: - lastDate = time.gmtime(lastItem.itemDate)[6] + if time.localtime(lastItem.itemDate)[6] != lastDate: + lastDate = time.localtime(lastItem.itemDate)[6] workingDate = PlanetDate(lastItem.itemDate) self.dates.append(workingDate) # append the item to the current date @@ -96,7 +96,7 @@ class XHTMLWriter: output += '

\n' if item.imageURL: output += '%s\n' % (item.imageLink, item.imageURL, item.blogTitle) - output += '(%s)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M UTC', time.gmtime(item.itemDate))) + output += '(%s)\n' % (item.itemURL ,time.strftime('%A %B %d, %Y %H:%M AWST', time.localtime(item.itemDate))) output += '

\n' output += '

\n' output += item.contents @@ -129,7 +129,7 @@ class XHTMLWriter: pass output += '

Last Updated

\n' output += '

\n' - output += '%s\n' % time.strftime('%A %B %d, %Y %H:%M UTC', time.gmtime()) + output += '%s\n' % time.strftime('%A %B %d, %Y %H:%M AWST', time.localtime()) output += '

\n' if self.parent: output += '

Feeds

\n' @@ -140,7 +140,7 @@ class XHTMLWriter: output += '\n' output += '
\n' for date in self.planet: - output += '

%s

\n' % time.strftime('%A %B %d, %Y', time.gmtime(date.planetDate)) + output += '

%s

\n' % time.strftime('%A %B %d, %Y', time.localtime(date.planetDate)) for item in date.items: output += self.__write_item__(item) # see how many items we've written