code: TimeVal time_diff(final TimeVal before, final TimeVal after_t) {
  	final double bef_d = before.tv_sec + (double) before.tv_usec / 1000000;
  	final double aft_d = after_t.tv_sec + (double) after_t.tv_usec / 1000000;
  	final double diff_d = aft_d - bef_d;
  
  	final TimeVal result = new TimeVal();
  	result.tv_sec = (int) diff_d;
  	result.tv_usec = (int) ((diff_d - result.tv_sec) * 1000000);
  	return result;
      }
docs: ===============================================================