FreeBSD/contrib/openbsm/libbsm/bsm_control.c
/*
 * Convert a given time value with a multiplier (seconds, hours, days, years) to
 * seconds.  Return 0 on success.
 */
Convert a given time value with a multiplier (seconds, hours, days, years) to
seconds.  Return 0 on success.
Convert a given time value with a multiplier ( seconds hours days years ) to seconds . Return 0 on success .
static int
au_timetosec(time_t *seconds, u_long value, char mult)
{
	if (NULL == seconds)
		return (-1);
	switch(mult) {
	case 's':
		*seconds = (time_t)value;
		break;
	case 'h':
		*seconds = (time_t)value * 60 * 60;
		break;
	case 'd':
		*seconds = (time_t)value * 60 * 60 * 24;
		break;
	case 'y':
		*seconds = (time_t)value * 60 * 60 * 24 * 364 +
		    ((time_t)value / 4) * 60 * 60 * 24;
		break;
	default:
		return (-1);
	}
	return (0);
}
static int au_timetosec ( time_t * seconds , u_long value , char mult ) { if ( NULL == seconds ) return ( -1 ) ; switch ( mult ) { case ' ' : * seconds = ( time_t ) value ; break ; case ' ' : * seconds = ( time_t ) value * 60 * 60 ; break ; case ' ' : * seconds = ( time_t ) value * 60 * 60 * 24 ; break ; case ' ' : * seconds = ( time_t ) value * 60 * 60 * 24 * 364 + ( ( time_t ) value / 4 ) * 60 * 60 * 24 ; break ; default : return ( -1 ) ; } return ( 0 ) ; }
Convert a given time value with a multiplier (seconds, hours, days, years) to
 seconds.
Convert a given time value with a multiplier ( seconds hours days years ) to seconds .
/* seconds */ /* hours */ /* days */ /* years.  Add a day for each 4th (leap) year. */