| 684 | */ |
| 685 | |
| 686 | static char * |
| 687 | _yconv(int a, int b, bool convert_top, bool convert_yy, |
| 688 | char *pt, const char *ptlim) |
| 689 | { |
| 690 | register int lead; |
| 691 | register int trail; |
| 692 | |
| 693 | int DIVISOR = 100; |
| 694 | trail = a % DIVISOR + b % DIVISOR; |
| 695 | lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR; |
| 696 | trail %= DIVISOR; |
| 697 | if (trail < 0 && lead > 0) { |
| 698 | trail += DIVISOR; |
| 699 | --lead; |
| 700 | } else if (lead < 0 && trail > 0) { |
| 701 | trail -= DIVISOR; |
| 702 | ++lead; |
| 703 | } |
| 704 | if (convert_top) { |
| 705 | if (lead == 0 && trail < 0) |
| 706 | pt = _add("-0", pt, ptlim); |
| 707 | else pt = _conv(lead, "%02d", pt, ptlim); |
| 708 | } |
| 709 | if (convert_yy) |
| 710 | pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim); |
| 711 | return pt; |
| 712 | } |