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