test_tools.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*****************************************************************************
  2. *
  3. * MODULE: Grass g3d Library
  4. * AUTHOR(S): Soeren Gebbert, Braunschweig (GER) Jun 2011
  5. * soerengebbert <at> googlemail <dot> com
  6. *
  7. * PURPOSE: Unit and Integration tests
  8. *
  9. * COPYRIGHT: (C) 2000 by the GRASS Development Team
  10. *
  11. * This program is free software under the GNU General Public
  12. * License (>=v2). Read the file COPYING that comes with GRASS
  13. * for details.
  14. *
  15. *****************************************************************************/
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #include <math.h>
  20. #include "test_g3d_lib.h"
  21. #include <sys/time.h>
  22. /* *************************************************************** */
  23. /* Compute the difference between two time steps ***************** */
  24. /* *************************************************************** */
  25. double compute_time_difference(struct timeval start, struct timeval end) {
  26. int sec;
  27. int usec;
  28. sec = end.tv_sec - start.tv_sec;
  29. usec = end.tv_usec - start.tv_usec;
  30. return (double) sec + (double) usec / 1000000;
  31. }