~nickpapior/siesta/4.0-trs

« back to all changes in this revision

Viewing changes to Src/Sys/glib.c

  • Committer: Alberto Garcia
  • Date: 2004-11-24 20:24:00 UTC
  • Revision ID: Arch-1:siesta@uam.es--2004%siesta-release--reference--0.9--base-0
initial import

(automatically generated log message)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Auxiliary routines
 
3
*/
 
4
 
 
5
/*
 
6
   From elgin@claudia.spectral.com (Jim Elgin)
 
7
*/
 
8
 
 
9
/*  supply "etime" fortran routine
 
10
 
 
11
 NAME
 
12
      etime - return elapsed execution time
 
13
 
 
14
 SYNOPSIS
 
15
      REAL function etime (tarray)
 
16
      REAL tarray(2)
 
17
 
 
18
 DESCRIPTION
 
19
      This routine returns elapsed runtime in seconds for the calling
 
20
      process.
 
21
 
 
22
      The argument array returns user time in the first element and system
 
23
      time in the second element.  The function value is the sum of user and
 
24
      system time.
 
25
 
 
26
      The resolution of all timing is 1/CLK_TCK seconds, where CLK_TCK is
 
27
      processor dependent.
 
28
*/
 
29
#include <unistd.h>
 
30
#include <sys/times.h>
 
31
 
 
32
float etime_(tarray)
 
33
float *tarray;
 
34
{
 
35
struct tms buf;
 
36
float t1, t2, den, tot;
 
37
 
 
38
times(&buf);
 
39
t1 = buf.tms_utime;
 
40
t2 = buf.tms_stime;
 
41
den = sysconf(_SC_CLK_TCK);
 
42
*tarray = t1/den;
 
43
*(tarray+1) = t2/den;
 
44
tot = *tarray + *(tarray+1);
 
45
return tot;
 
46
}
 
47
#include<time.h>
 
48
void fdate_(utime)
 
49
char utime[24];
 
50
{
 
51
int i;
 
52
time_t t;
 
53
t=time (NULL);
 
54
for (i=0; i<24; i++)
 
55
 utime[i]= *(ctime(&t)+i);
 
56
}
 
57
 
 
58
#include <stdlib.h>
 
59
void exit_(status)
 
60
int *status;
 
61
{
 
62
  exit(*status);
 
63
}
 
64