MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sec2str

Function sec2str

tools/ifconfig/af_inet6.c:427–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425}
426
427static char *
428sec2str(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
460static void
461in6_postproc(int s, const struct afswtch *afp)

Callers 1

af_inet6.cFile · 0.70

Calls 1

sprintfFunction · 0.85

Tested by

no test coverage detected