FreeBSD/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_if.c
/*
 * Calculate the timeticks since the last topology change.
 */
Calculate the timeticks since the last topology change.
Calculate the timeticks since the last topology change .
static int
bridge_get_time_since_tc(struct bridge_if *bif, uint32_t *ticks)
{
	struct timeval ct;
	if (gettimeofday(&ct, NULL) < 0) {
		syslog(LOG_ERR, "bridge get time since last TC:"
		    "getttimeofday failed: %s", strerror(errno));
		return (-1);
	}
	if (ct.tv_usec - bif->last_tc_time.tv_usec < 0) {
		ct.tv_sec -= 1;
		ct.tv_usec += 1000000;
	}
	ct.tv_sec -= bif->last_tc_time.tv_sec;
	ct.tv_usec -= bif->last_tc_time.tv_usec;
	*ticks = ct.tv_sec * 100 + ct.tv_usec/10000;
	return (0);
}
static int bridge_get_time_since_tc ( struct bridge_if * bif , uint32_t * ticks ) { struct timeval ct ; if ( gettimeofday ( & ct , NULL ) < 0 ) { syslog ( LOG_ERR , " " " " , strerror ( errno ) ) ; return ( -1 ) ; } if ( ct . tv_usec - bif -> last_tc_time . tv_usec < 0 ) { ct . tv_sec -= 1 ; ct . tv_usec += 1000000 ; } ct . tv_sec -= bif -> last_tc_time . tv_sec ; ct . tv_usec -= bif -> last_tc_time . tv_usec ; * ticks = ct . tv_sec * 100 + ct . tv_usec / 10000 ; return ( 0 ) ; }
Calculate the timeticks since the last topology change.
Calculate the timeticks since the last topology change .