[Zope-dev] Bug in DateTime.py

Karsten Petersen karsten.petersen@informatik.tu-chemnitz.de
Tue, 8 Aug 2000 00:53:50 +0200 (CEST)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--1208615426-1671415248-965688830=:1100
Content-Type: TEXT/PLAIN; charset=US-ASCII

Hi,

today I had *very* strange effects with the following code:
	<dtml-let bla="_.DateTime('2000/08/08')">
	  <dtml-var bla><br>
	  <dtml-var expr="bla.parts()"><br>
	  <dtml-var expr="bla.strftime('%Y/%m/%d')"><br>
	</dtml-let>

on my system it gave me:
	2000/08/08
	(2000, 8, 8, 0, 0, 0, 'GMT+2')
	2000/08/07

Well - this was not quite what I expected. :)

I tracked the problem down to the timezone: When no time is given, the
time is initialized with 00:00. So after applying gmtime in the strftime
function (DateTime.py line 1379) it got shifted out and - hoppla - we
have gone one day back in time. :)

When I apply the attached patch, the output gets correct. But there are
more usages of gmtime in the file and I don't know right now if that is
correct. Perhaps someone who has a deeper insight in date'n'time math
than me should have a look at it.

Greets, Karsten
-- 
,-,  Student of Computer Science at Chemnitz University of Technology  ,-,
| |    EMail:  Karsten@kapet.de          WWW:  http://www.kapet.de/    | |
'-'  Home: kapet@dollerup.csn   V72 / 230    Phone: +49-177-82 35 136  '-'

--1208615426-1671415248-965688830=:1100
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="DateTime_strftime.patch"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.21.0008080053500.1100@lola.kapet.vpn>
Content-Description: Patch
Content-Disposition: attachment; filename="DateTime_strftime.patch"

LS0tIERhdGVUaW1lLnB5LXZhbmlsbGEJVHVlIEF1ZyAgOCAwMDo0NzoxNyAy
MDAwDQorKysgRGF0ZVRpbWUucHkJVHVlIEF1ZyAgOCAwMDo0NzozMSAyMDAw
DQpAQCAtMTM3Niw3ICsxMzc2LDcgQEANCiAgICAgICAgIHJldHVybiBtaWxs
aXMNCiANCiAgICAgZGVmIHN0cmZ0aW1lKHNlbGYsIGZvcm1hdCk6DQotICAg
ICAgICByZXR1cm4gc3RyZnRpbWUoZm9ybWF0LCBnbXRpbWUoc2VsZi50aW1l
VGltZSgpKSkNCisgICAgICAgIHJldHVybiBzdHJmdGltZShmb3JtYXQsIGxv
Y2FsdGltZShzZWxmLnRpbWVUaW1lKCkpKQ0KIA0KICAgICAjIEdlbmVyYWwg
Zm9ybWF0cyBmcm9tIHByZXZpb3VzIERhdGVUaW1lDQogICAgIGRlZiBEYXRl
KHNlbGYpOg0K
--1208615426-1671415248-965688830=:1100--