Re: [Mailman-Developers] clobber_date bug
While clobber_date doesn't process the existing date, it seems to replace it by the local date (namely the output of ctime(time()). That seems correct to me. Are you certain your local TZ is set properly?
Using python 1.5.2, ctime() is giving local time without timezone info.
Good point. It's the correct time, but it's not fully-qualified. I get it.
If I use asctime(gmtime(time)) I seem to get the correct result.
[eds@ike eds]$ python Python 1.5.2 (#1, Dec 21 2000, 15:29:08) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
time.ctime(time.time()) 'Thu Nov 8 16:01:44 2001' time.tzname ('CST', 'CDT') time.timezone /3600 6 time.asctime(time.gmtime(time.time())) 'Thu Nov 8 22:06:05 2001'
Well, sorta. You really want that TZ information appended.
So it looks like my options are to use asctime(gmtime(time)) or write a routine that parses time.timezone into "-0600".
Luckily 'altzone' is defined in time, so
"+%02d%02d" % (time.altzone / 3600, time.altzone % 3600)
seems to do it. But it sure looks like a bug to me.
On Thu, Nov 08, 2001 at 02:23:58PM -0800, Dan Mick wrote:
So it looks like my options are to use asctime(gmtime(time)) or write a routine that parses time.timezone into "-0600".
Luckily 'altzone' is defined in time, so
"+%02d%02d" % (time.altzone / 3600, time.altzone % 3600)
Well, that's not totally right either. It doesn't look as though 'time' has a function to tell us if we're in the DST timezone or the non-DST timezone, so there's no way to tell if we're supposed to use 'timezone' or 'altzone'. So it looks to me like using 'gmtime' is the only way to get the right info under all circumstances.
To be totally RFC 822/2822 compliant, you could convert to GMT (using gmtime) and then blindly append "+0000". But since (in 2.0.6) this only happens to messages on the way to being archived, it doesn't seem terribly likely that message will ever be resent again. So as long as the archiver is happy I'm not too concerned.
Ugh. I just noticed that RFC 2822 requires day-month-year-time order, while ctime and asctime produce month-day-time year order. So looks to me like this is most correct:
time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(time.time()))
participants (2)
-
Dan Mick
-
Eric Seppanen