source: git/ntl/src/GetTime4.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: 566 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 <time.h>
8
9
10#if (defined(__cplusplus) && !defined(NTL_CXX_ONLY))
11extern "C" double _ntl_GetTime();
12#endif
13
14
15double _ntl_GetTime(void)
16{
17   static clock_t last_clock = 0;
18   static double acc = 0;
19
20   clock_t this_clock;
21   double delta;
22
23   this_clock = clock();
24
25   delta = (this_clock - last_clock)/((double)CLOCKS_PER_SEC);
26   if (delta < 0) delta = 0;
27
28   acc += delta;
29   last_clock = this_clock;
30
31   return acc;
32}
33
Note: See TracBrowser for help on using the repository browser.