/[ascend]/trunk/ascend/general/tm_time.c
ViewVC logotype

Annotation of /trunk/ascend/general/tm_time.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (hide annotations) (download) (as text)
Sat Nov 13 16:45:56 2004 UTC (19 years, 10 months ago) by aw0a
Original Path: trunk/base/generic/general/tm_time.c
File MIME type: text/x-csrc
File size: 1932 byte(s)
moving things to base/generic
1 aw0a 1 /*
2     * Time module
3     * by Karl Westerberg
4     * Created: 6/90
5     * Version: $Revision: 1.1 $
6     * Version control file: $RCSfile: tm_time.c,v $
7     * Date last modified: $Date: 2000/01/25 02:21:26 $
8     * Last modified by: $Author: ballan $
9     *
10     * This file is part of the Ascend Language Interpreter.
11     *
12     * Copyright (C) 1997 Carnegie Mellon University
13     *
14     * The Ascend Language Interpreter is free software; you can redistribute
15     * it and/or modify it under the terms of the GNU General Public License as
16     * published by the Free Software Foundation; either version 2 of the
17     * License, or (at your option) any later version.
18     *
19     * The Ascend Language Interpreter is distributed in hope that it will be
20     * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22     * General Public License for more details.
23     *
24     * You should have received a copy of the GNU General Public License
25     * along with the program; if not, write to the Free Software Foundation,
26     * Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named
27     * COPYING. COPYING is in ../compiler.
28     */
29    
30     #include <time.h>
31     #include "utilities/ascConfig.h"
32     #include "general/tm_time.h"
33    
34     double tm_cpu_time()
35     {
36     static boolean first = TRUE;
37     static clock_t ref;
38     static double dref;
39     static double dcps;
40     clock_t now;
41     double dnow;
42    
43     if( first ) {
44     dcps = (double) CLOCKS_PER_SEC;
45     ref = clock();
46     dref = (double) ref;
47     first = FALSE;
48     }
49     now = clock();
50     dnow = (double) now;
51    
52     return( (dnow - dref)/dcps );
53     }
54    
55     void tm_cpu_time_ftn_(double *t)
56     {
57     *t = tm_cpu_time();
58     }
59    
60     void aftime_(double *t)
61     {
62     *t = tm_cpu_time();
63     }
64    
65     void tm_cpu_time_ftn(double *t)
66     {
67     *t = tm_cpu_time();
68     }
69    
70     void aftime(double *t)
71     {
72     *t = tm_cpu_time();
73     }
74    
75     void TM_CPU_TIME_FTN(double *t)
76     {
77     *t = tm_cpu_time();
78     }
79    
80     void AFTIME(double *t)
81     {
82     *t = tm_cpu_time();
83     }

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22