FreeBSD/usr.bin/w/pr_time.c
/*
 * pr_idle --
 *	Display the idle time.
 *	Returns number of excess characters that were used for long idle time.
 */
pr_idle
Display the idle time.
Returns number of excess characters that were used for long idle time.
pr_idle Display the idle time . Returns number of excess characters that were used for long idle time .
int
pr_idle(time_t idle)
{
	if (idle >= 36 * 3600) {
		int days = idle / 86400;
		xo_emit(" {:idle/%dday%s} ", days, days > 1 ? "s" : " " );
		if (days >= 100)
			return (2);
		if (days >= 10)
			return (1);
	}
	else if (idle >= 3600)
		xo_emit(" {:idle/%2d:%02d/} ",
		    (int)(idle / 3600), (int)((idle % 3600) / 60));
	else if (idle / 60 == 0)
		xo_emit("     - ");
	else
		xo_emit("    {:idle/%2d} ", (int)(idle / 60));
	return (0); 
}
int pr_idle ( time_t idle ) { if ( idle >= 36 * 3600 ) { int days = idle / 86400 ; xo_emit ( " " , days , days > 1 ? " " : " " ) ; if ( days >= 100 ) return ( 2 ) ; if ( days >= 10 ) return ( 1 ) ; } else if ( idle >= 3600 ) xo_emit ( " " , ( int ) ( idle / 3600 ) , ( int ) ( ( idle % 3600 ) / 60 ) ) ; else if ( idle / 60 == 0 ) xo_emit ( " " ) ; else xo_emit ( " " , ( int ) ( idle / 60 ) ) ; return ( 0 ) ; }
pr_idle
      Display the idle time.
pr_idle Display the idle time .
/* If idle more than 36 hours, print as a number of days. */ /* If idle more than an hour, print as HH:MM. */ /* Else print the minutes idle. */ /* not idle longer than 9 days */