Converts two-digit years to year within [-50, 49] range of self._year (current local time)
(self, year, century_specified=False)
| 352 | return self.TZOFFSET.get(name) |
| 353 | |
| 354 | def convertyear(self, year, century_specified=False): |
| 355 | """ |
| 356 | Converts two-digit years to year within [-50, 49] |
| 357 | range of self._year (current local time) |
| 358 | """ |
| 359 | |
| 360 | # Function contract is that the year is always positive |
| 361 | assert year >= 0 |
| 362 | |
| 363 | if year < 100 and not century_specified: |
| 364 | # assume current century to start |
| 365 | year += self._century |
| 366 | |
| 367 | if year >= self._year + 50: # if too far in future |
| 368 | year -= 100 |
| 369 | elif year < self._year - 50: # if too far in past |
| 370 | year += 100 |
| 371 | |
| 372 | return year |
| 373 | |
| 374 | def validate(self, res): |
| 375 | # move to info |
no outgoing calls