source: git/ntl/src/GetTime.c @ 33a041

spielwiese
Last change on this file since 33a041 was 09da99, checked in by Hans Schönemann <hannes@…>, 21 years ago
*hannes: NTL- 5.3.1 git-svn-id: file:///usr/local/Singular/svn/trunk@6910 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 584 bytes
Line 
1#include <NTL/config.h>
2
3#if (defined(NTL_CXX_ONLY) && !defined(__cplusplus))
4#error "CXX_ONLY flag set...must use C++ compiler"
5#endif
6
7#include <sys/time.h>
8#include <sys/resource.h>
9
10#if (defined(__cplusplus))
11extern "C"
12#else
13extern
14#endif
15int getrusage(int, struct rusage*);
16
17#if (defined(__cplusplus) && !defined(NTL_CXX_ONLY))
18extern "C" double _ntl_GetTime();
19#endif
20
21double _ntl_GetTime(void)
22{
23   struct rusage used;
24
25   getrusage(RUSAGE_SELF, &used);
26   return (used.ru_utime.tv_sec + used.ru_stime.tv_sec +
27      (used.ru_utime.tv_usec + used.ru_stime.tv_usec) / 1e6);
28}
29
Note: See TracBrowser for help on using the repository browser.