| 425 | } |
| 426 | |
| 427 | static char * |
| 428 | sec2str(time_t total) |
| 429 | { |
| 430 | static char result[256]; |
| 431 | int days, hours, mins, secs; |
| 432 | int first = 1; |
| 433 | char *p = result; |
| 434 | |
| 435 | if (0) { |
| 436 | days = total / 3600 / 24; |
| 437 | hours = (total / 3600) % 24; |
| 438 | mins = (total / 60) % 60; |
| 439 | secs = total % 60; |
| 440 | |
| 441 | if (days) { |
| 442 | first = 0; |
| 443 | p += sprintf(p, "%dd", days); |
| 444 | } |
| 445 | if (!first || hours) { |
| 446 | first = 0; |
| 447 | p += sprintf(p, "%dh", hours); |
| 448 | } |
| 449 | if (!first || mins) { |
| 450 | first = 0; |
| 451 | p += sprintf(p, "%dm", mins); |
| 452 | } |
| 453 | sprintf(p, "%ds", secs); |
| 454 | } else |
| 455 | sprintf(result, "%lu", (unsigned long)total); |
| 456 | |
| 457 | return(result); |
| 458 | } |
| 459 | |
| 460 | static void |
| 461 | in6_postproc(int s, const struct afswtch *afp) |