source: tags/1.1/clocks.cpp @ 5

Last change on this file since 5 was 5, checked in by willem, 11 years ago

willem

File size: 795 bytes
Line 
1#include <sys/times.h>
2#include <sys/time.h>
3#include <time.h>
4#include <stdlib.h>
5#include "clocks.h"
6#include <unistd.h>
7double cputime() /* aix, xlf */
8{ struct tms b;
9  clock_t r;
10  times( &b);
11  r = b.tms_utime + b.tms_stime;
12  return ( (double) r/(double) sysconf(_SC_CLK_TCK));
13}
14double CPUTIME() /* cray  */
15{ 
16  return ( cputime());
17}
18double cputime_() /* g77, gcc */
19{ 
20  return ( cputime());
21}
22
23double wallclock() 
24{ 
25        struct timeval toot;
26        double r;
27
28        gettimeofday(&toot,0);
29        r=toot.tv_sec+0.000001*(double)toot.tv_usec;
30        return(r);
31}
32double WALLCLOCK()
33{
34  return (wallclock());
35}
36double wallclock_()
37{
38  return wallclock();
39}
40               
41void fortransleep(int *i)
42  {
43    sleep(*i);
44  }
45 
46void FORTRANSLEEP(int *i)
47  {
48    sleep(*i);
49  }
50
51void fortransleep_(int *i)
52  {
53    sleep(*i);
54  }
55
Note: See TracBrowser for help on using the repository browser.