[Zope-Checkins]
SVN: Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py
more methods migrated
Andreas Jung
andreas at andreas-jung.com
Sun Aug 26 04:42:02 EDT 2007
Log message for revision 79278:
more methods migrated
Changed:
U Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py
-=-
Modified: Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py
===================================================================
--- Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py 2007-08-26 08:22:36 UTC (rev 79277)
+++ Zope/branches/ajung-DateTime-must-die-branch/lib/python/DateTime/DateTime.py 2007-08-26 08:42:01 UTC (rev 79278)
@@ -1332,16 +1332,20 @@
possible time (in whole seconds) that still falls within
the current object\'s day, in the object\'s timezone context.
"""
- return self.__class__(self._year,self._month,self._day,0,0,0,self._tz)
+ # MIGRATED
+ return self.__class__(self._D.year, self._D.month, self._D.day,
+ 0, 0, 0, self._tz)
def latestTime(self):
"""Return a new DateTime object that represents the latest
possible time (in whole seconds) that still falls within
the current object\'s day, in the object\'s timezone context.
"""
- return self.__class__(self._year,self._month,self._day,
- 23,59,59,self._tz)
+ # MIGRATED
+ return self.__class__(self._D.year, self._D.month, self._D.day,
+ 23, 59, 59, self._tz)
+
def greaterThan(self,t):
"""Compare this DateTime object to another DateTime object
OR a floating point number such as that which is returned
@@ -1349,17 +1353,12 @@
Returns true if the object represents a date/time greater
than the specified DateTime or time module style time.
-
- Revised to give more correct results through comparison of
- long integer milliseconds.
"""
- # Optimized for sorting speed
+ # MIGRATED
try:
- return (self._millis > t._millis)
+ return self._D.utctimetuple() > t._D.utctimetuple()
except AttributeError:
- try: self._millis
- except AttributeError: self._upgrade_old()
- return (self._t > t)
+ return self._D.utctimetuple() > datetime.fromtimestamp(t).utctimetuple()
__gt__ = greaterThan
@@ -1371,17 +1370,12 @@
Returns true if the object represents a date/time greater
than or equal to the specified DateTime or time module style
time.
-
- Revised to give more correct results through comparison of
- long integer milliseconds.
"""
- # Optimized for sorting speed
+ # MIGRATED
try:
- return (self._millis >= t._millis)
+ return self._D.utctimetuple() >= t._D.utctimetuple()
except AttributeError:
- try: self._millis
- except AttributeError: self._upgrade_old()
- return (self._t >= t)
+ return self._D.utctimetuple() >= datetime.fromtimestamp(t).utctimetuple()
__ge__ = greaterThanEqualTo
@@ -1434,17 +1428,12 @@
Returns true if the object represents a date/time less than
the specified DateTime or time module style time.
-
- Revised to give more correct results through comparison of
- long integer milliseconds.
"""
- # Optimized for sorting speed
+ # MIGRATED
try:
- return (self._millis < t._millis)
+ return self._D.utctimetuple() < t._D.utctimetuple()
except AttributeError:
- try: self._millis
- except AttributeError: self._upgrade_old()
- return (self._t < t)
+ return self._D.utctimetuple() < datetime.fromtimestamp(t).utctimetuple()
__lt__ = lessThan
@@ -1455,18 +1444,14 @@
Returns true if the object represents a date/time less than
or equal to the specified DateTime or time module style time.
-
- Revised to give more correct results through comparison of
- long integer milliseconds.
"""
- # Optimized for sorting speed
+ # MIGRATED
try:
- return (self._millis <= t._millis)
+ return self._D.utctimetuple() <= t._D.utctimetuple()
except AttributeError:
- try: self._millis
- except AttributeError: self._upgrade_old()
- return (self._t <= t)
+ return self._D.utctimetuple() <= datetime.fromtimestamp(t).utctimetuple()
+
__le__ = lessThanEqualTo
def isLeapYear(self):
More information about the Zope-Checkins
mailing list