Re: [Zope-dev] Bug in DateTime.py

2000-08-08 Thread Steve Alexander

Karsten Petersen wrote:
> 
> Hi,
> 
> today I had *very* strange effects with the following code:
> 
>   
>   
>   
> 
> 
> 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. :)

Use the patch here:

  http://classic.zope.org:8080/Collector/1457/view

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




[Zope-dev] Bug in DateTime.py

2000-08-07 Thread Karsten Petersen

Hi,

today I had *very* strange effects with the following code:

  
  
  


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:  [EMAIL PROTECTED]  WWW:  http://www.kapet.de/| |
'-'  Home: [EMAIL PROTECTED]   V72 / 230Phone: +49-177-82 35 136  '-'


--- DateTime.py-vanilla Tue Aug  8 00:47:17 2000
+++ DateTime.py Tue Aug  8 00:47:31 2000
@@ -1376,7 +1376,7 @@
 return millis
 
 def strftime(self, format):
-return strftime(format, gmtime(self.timeTime()))
+return strftime(format, localtime(self.timeTime()))
 
 # General formats from previous DateTime
 def Date(self):