|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: date.py,v 1.88 2006-09-09 05:50:17 richard Exp $ |
| 18 | +# $Id: date.py,v 1.89 2006-12-28 22:38:02 richard Exp $ |
19 | 19 |
|
20 | 20 | """Date, time and time interval handling. |
21 | 21 | """ |
@@ -278,6 +278,7 @@ def __init__(self, spec='.', offset=0, add_granularity=0, translator=i18n): |
278 | 278 | self.second = _local_to_utc(y, m, d, H, M, S, offset) |
279 | 279 | # we lost the fractional part |
280 | 280 | self.second = self.second + frac |
| 281 | + if str(self.second) == '60.0': self.second = 59.9 |
281 | 282 | except: |
282 | 283 | raise ValueError, 'Unknown spec %r' % (spec,) |
283 | 284 |
|
@@ -313,6 +314,7 @@ def set(self, spec, offset=0, date_re=date_re, |
313 | 314 | y,m,d,H,M,S,x,x,x = time.gmtime(ts) |
314 | 315 | # gmtime loses the fractional seconds |
315 | 316 | S = S + frac |
| 317 | + if str(S) == '60.0': S = 59.9 |
316 | 318 |
|
317 | 319 | # whether we need to convert to UTC |
318 | 320 | adjust = False |
@@ -355,6 +357,7 @@ def set(self, spec, offset=0, date_re=date_re, |
355 | 357 | self.second = y, m, d, H, M, S |
356 | 358 | # we lost the fractional part along the way |
357 | 359 | self.second = self.second + frac |
| 360 | + if str(self.second) == '60.0': self.second = 59.9 |
358 | 361 |
|
359 | 362 | if info.get('o', None): |
360 | 363 | try: |
|
0 commit comments