FreeBSD/usr.sbin/edquota/edquota.c
/*
 * Convert seconds to ASCII times.
 */
Convert seconds to ASCII times.
Convert seconds to ASCII times .
char *
cvtstoa(uint64_t secs)
{
	static char buf[20];
	if (secs % (24 * 60 * 60) == 0) {
		secs /= 24 * 60 * 60;
		sprintf(buf, "%ju day%s", (uintmax_t)secs,
		    secs == 1 ? "" : "s");
	} else if (secs % (60 * 60) == 0) {
		secs /= 60 * 60;
		sprintf(buf, "%ju hour%s", (uintmax_t)secs,
		    secs == 1 ? "" : "s");
	} else if (secs % 60 == 0) {
		secs /= 60;
		sprintf(buf, "%ju minute%s", (uintmax_t)secs,
		    secs == 1 ? "" : "s");
	} else
		sprintf(buf, "%ju second%s", (uintmax_t)secs,
		    secs == 1 ? "" : "s");
	return (buf);
}
char * cvtstoa ( uint64_t secs ) { static char buf [ 20 ] ; if ( secs % ( 24 * 60 * 60 ) == 0 ) { secs /= 24 * 60 * 60 ; sprintf ( buf , " " , ( uintmax_t ) secs , secs == 1 ? " " : " " ) ; } else if ( secs % ( 60 * 60 ) == 0 ) { secs /= 60 * 60 ; sprintf ( buf , " " , ( uintmax_t ) secs , secs == 1 ? " " : " " ) ; } else if ( secs % 60 == 0 ) { secs /= 60 ; sprintf ( buf , " " , ( uintmax_t ) secs , secs == 1 ? " " : " " ) ; } else sprintf ( buf , " " , ( uintmax_t ) secs , secs == 1 ? " " : " " ) ; return ( buf ) ; }
Convert seconds to ASCII times.
Convert seconds to ASCII times .