Mercurial > p > roundup > code
diff roundup/date.py @ 3231:4a5893bfd70d
merge from maint-0-8
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 03 Mar 2005 04:49:16 +0000 |
| parents | ea29d69f7415 |
| children | 9c65e32514aa |
line wrap: on
line diff
--- a/roundup/date.py Thu Mar 03 02:18:02 2005 +0000 +++ b/roundup/date.py Thu Mar 03 04:49:16 2005 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: date.py,v 1.80 2005-02-25 17:15:47 a1s Exp $ +# $Id: date.py,v 1.81 2005-03-03 04:49:16 richard Exp $ """Date, time and time interval handling. """ @@ -135,6 +135,7 @@ elif have_datetime and isinstance(spec, datetime.datetime): # Python 2.3+ datetime object y,m,d,H,M,S,x,x,x = spec.timetuple() + if y < 1970: raise ValueError, 'year must be > 1970' S += spec.microsecond/1000000. spec = (y,m,d,H,M,S,x,x,x) elif hasattr(spec, 'tuple'): @@ -143,6 +144,7 @@ spec = spec.get_tuple() try: y,m,d,H,M,S,x,x,x = spec + if y < 1970: raise ValueError, 'year must be > 1970' frac = S - int(S) ts = calendar.timegm((y,m,d,H+offset,M,S,0,0,0)) self.year, self.month, self.day, self.hour, self.minute, \ @@ -195,6 +197,7 @@ if info['y'] is not None or info['a'] is not None: if info['y'] is not None: y = int(info['y']) + if y < 1970: raise ValueError, 'year must be > 1970' m,d = (1,1) if info['m'] is not None: m = int(info['m'])
