test_tools.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*****************************************************************************
  2. *
  3. * MODULE: Grass raster3d 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_raster3d_lib.h"
  21. /* *************************************************************** */
  22. /* Compute the difference between two time steps ***************** */
  23. /* *************************************************************** */
  24. double compute_time_difference(struct timeval start, struct timeval end) {
  25. int sec;
  26. int usec;
  27. sec = end.tv_sec - start.tv_sec;
  28. usec = end.tv_usec - start.tv_usec;
  29. return (double) sec + (double) usec / 1000000;
  30. }