[Python-checkins] python/nondist/sandbox/datetime doc.txt,1.57,1.58

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Sun, 15 Dec 2002 19:58:53 -0800


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv27923

Modified Files:
	doc.txt 
Log Message:
Added issue about timezone conversions.


Index: doc.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/doc.txt,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** doc.txt	16 Dec 2002 03:34:21 -0000	1.57
--- doc.txt	16 Dec 2002 03:58:51 -0000	1.58
***************
*** 1,4 ****
--- 1,26 ----
  TODO/OPEN
  =========
+ - The Python implementation has XXX comments, and so does the Wiki,
+   saying that timezone conversion APIs should be defined.  How about
+   this for a datetimetz method:
+ 
+   newtz(tzinfo)
+   Convert to a new time zone.  In dt.newtz(tz), an exception is raised
+   if dt is naive, tz does not implement utcoffset(), or tz.utcoffset()
+   returns None.
+ 
+   Else a datetimetz is returned with tzinfo=tz, converting the date
+   and time fields to local time in the tz time zone.  This is
+   equivalent to:
+ 
+     def newtz(self, tzinfo):
+         t = self - (self.utcoffset() - tzinfo.utcoffset())
+         return datetimetz(t.year, t.month, t.day,
+                           t.hour, t.minute, t.second,
+                           t.microsecond, tzinfo=tzinfo)
+ 
+   Note that this may overflow if dt.year is MINYEAR or MAXYEAR and
+   the adjustments spill over a year boundary.
+ 
  - The Python implementation is missing docstrings in many places.