来自time.strftime()的间歇性错误日期

时间:2012-05-10 04:30:14

标签: python google-app-engine

我有一个仍然在python2.5运行时运行的Appengine应用程序,这意味着它是单线程的。我有一个学校班级:

class School(db.Model):
    ...
    dateformat=db.StringProperty(default='%a %e %b',indexed=False) # For bookings
    timeformat=db.StringProperty(default='%l:%M%P',indexed=False) # For bookings
    def date(self,t):
        return time.strftime(self.dateformat,time.gmtime(t))
    def datetime(self,bt,et=None):
        return time.strftime(self.dateformat+' '+self.timeformat,time.gmtime(bt))+\
                (time.strftime(' - '+self.timeformat,time.gmtime(et)) if et else '')
    def time(self,t):
        return time.strftime(self.timeformat,time.gmtime(t))

然后当我想用学校选择的格式格式化日期时,我这样做:

s=School.get_by_id(the_id)
date_string=s.date(the_timestamp)

偶尔,我得到的日期恰好是一周。因此,不是“5月2日星期三”,而是“5月9日星期三”。据报道,上周已有三次报道,可能有数万起病例。所有完全一周,没有任何其他时差。

我的代码中的那段时间没有任何改变,所以我不明白为什么这应该突然开始发生。因为它是单线程的,所以不应该有strftime的问题,无论如何我无法找到任何关于它的线程问题的报告。

有什么想法吗?

0 个答案:

没有答案