FreeBSD/sbin/camcontrol/progress.c
/* update the values in the progress meter */
update the values in the progress meter
update the values in the progress meter
int
progress_update(progress_t *prog, uint64_t done)
{
	prog->done = done;
	prog->percent = (prog->done * 100) / prog->size;
	prog->now = time(NULL);
	prog->elapsed = prog->now - prog->start;
	if (done == 0 || prog->elapsed == 0 || prog->done / prog->elapsed == 0) {
		prog->eta = 0;
	} else {
		prog->eta = prog->size / (prog->done / prog->elapsed) - prog->elapsed;
	}
	return 1;
}
int progress_update ( progress_t * prog , uint64_t done ) { prog -> done = done ; prog -> percent = ( prog -> done * 100 ) / prog -> size ; prog -> now = time ( NULL ) ; prog -> elapsed = prog -> now - prog -> start ; if ( done == 0 || prog -> elapsed == 0 || prog -> done / prog -> elapsed == 0 ) { prog -> eta = 0 ; } else { prog -> eta = prog -> size / ( prog -> done / prog -> elapsed ) - prog -> elapsed ; } return 1 ; }
update the values in the progress meter
update the values in the progress meter