Mercurial > p > roundup > code
comparison roundup/date.py @ 2730:8a4a2e135a73 maint-0.7
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 08 Oct 2004 00:34:58 +0000 |
| parents | 770f9fa94c6a |
| children | 145cd31e258b |
comparison
equal
deleted
inserted
replaced
| 2728:572746c94537 | 2730:8a4a2e135a73 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: date.py,v 1.68.2.3 2004-09-29 07:31:32 richard Exp $ | 18 # $Id: date.py,v 1.68.2.4 2004-10-08 00:34:58 richard Exp $ |
| 19 | 19 |
| 20 """Date, time and time interval handling. | 20 """Date, time and time interval handling. |
| 21 """ | 21 """ |
| 22 __docformat__ = 'restructuredtext' | 22 __docformat__ = 'restructuredtext' |
| 23 | 23 |
| 449 """Construct an interval given a specification.""" | 449 """Construct an interval given a specification.""" |
| 450 if type(spec) in (IntType, FloatType, LongType): | 450 if type(spec) in (IntType, FloatType, LongType): |
| 451 self.from_seconds(spec) | 451 self.from_seconds(spec) |
| 452 elif type(spec) in (StringType, UnicodeType): | 452 elif type(spec) in (StringType, UnicodeType): |
| 453 self.set(spec, allowdate=allowdate, add_granularity=add_granularity) | 453 self.set(spec, allowdate=allowdate, add_granularity=add_granularity) |
| 454 elif isinstance(spec, Interval): | |
| 455 (self.sign, self.year, self.month, self.day, self.hour, | |
| 456 self.minute, self.second) = spec.get_tuple() | |
| 454 else: | 457 else: |
| 455 if len(spec) == 7: | 458 if len(spec) == 7: |
| 456 self.sign, self.year, self.month, self.day, self.hour, \ | 459 self.sign, self.year, self.month, self.day, self.hour, \ |
| 457 self.minute, self.second = spec | 460 self.minute, self.second = spec |
| 458 self.second = int(self.second) | 461 self.second = int(self.second) |
