source: git/ntl/src/GetTime3.c @ 6ce030f

spielwiese
Last change on this file since 6ce030f was 09da99, checked in by Hans Schönemann <hannes@…>, 20 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: 525 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#include <syscall.h>
10
11
12#if (defined(__cplusplus) && !defined(NTL_CXX_ONLY))
13extern "C" double _ntl_GetTime();
14#endif
15
16
17double _ntl_GetTime(void)
18{
19   struct rusage used;
20
21   syscall(SYS_getrusage, RUSAGE_SELF, &used);
22   return (used.ru_utime.tv_sec + used.ru_stime.tv_sec +
23      (used.ru_utime.tv_usec + used.ru_stime.tv_usec) / 1e6);
24}
25
Note: See TracBrowser for help on using the repository browser.