Mercurial > p > roundup > code
comparison roundup/date.py @ 2541:5080ca961b2e maint-0.7
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 04 Jul 2004 09:08:55 +0000 |
| parents | 1cc51a44ce39 |
| children | 770f9fa94c6a |
comparison
equal
deleted
inserted
replaced
| 2537:5455dd2ec6d7 | 2541:5080ca961b2e |
|---|---|
| 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.1 2004-06-08 05:39:37 richard Exp $ | 18 # $Id: date.py,v 1.68.2.2 2004-07-04 09:08:55 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 |
| 121 if type(spec) == type(''): | 121 if type(spec) == type(''): |
| 122 self.set(spec, offset=offset, add_granularity=add_granularity) | 122 self.set(spec, offset=offset, add_granularity=add_granularity) |
| 123 return | 123 return |
| 124 elif hasattr(spec, 'tuple'): | 124 elif hasattr(spec, 'tuple'): |
| 125 spec = spec.tuple() | 125 spec = spec.tuple() |
| 126 elif isinstance(spec, Date): | |
| 127 spec = spec.get_tuple() | |
| 126 try: | 128 try: |
| 127 y,m,d,H,M,S,x,x,x = spec | 129 y,m,d,H,M,S,x,x,x = spec |
| 128 frac = S - int(S) | 130 frac = S - int(S) |
| 129 ts = calendar.timegm((y,m,d,H+offset,M,S,0,0,0)) | 131 ts = calendar.timegm((y,m,d,H+offset,M,S,0,0,0)) |
| 130 self.year, self.month, self.day, self.hour, self.minute, \ | 132 self.year, self.month, self.day, self.hour, self.minute, \ |
