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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2050 - (show annotations) (download) (as text)
Mon Jun 15 07:17:22 2009 UTC (14 years, 11 months ago) by jpye
File MIME type: text/x-csrc
File size: 2153 byte(s)
Add efficiency calc to rankine_reheat_regen.
Remove dcps from time calc.
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 <ascend/utilities/ascConfig.h>
32 #include <ascend/utilities/ascPanic.h>
33 #include "tm_time.h"
34
35 static boolean f_first = TRUE;
36
37 double tm_cpu_time(void)
38 {
39 static clock_t ref;
40 static double dref;
41 clock_t now;
42 double dnow;
43
44 if( f_first ) {
45 ref = clock();
46 dref = (double) ref;
47 f_first = FALSE;
48 }
49 now = clock();
50 dnow = (double) now;
51
52 return((dnow - dref)/CLOCKS_PER_SEC);
53 }
54
55 double tm_reset_cpu_time(void)
56 {
57 f_first = TRUE;
58 return tm_cpu_time();
59 }
60
61 void tm_cpu_time_ftn_(double *t)
62 {
63 asc_assert(NULL != t);
64 *t = tm_cpu_time();
65 }
66
67 void aftime_(double *t)
68 {
69 asc_assert(NULL != t);
70 *t = tm_cpu_time();
71 }
72
73 void tm_cpu_time_ftn(double *t)
74 {
75 asc_assert(NULL != t);
76 *t = tm_cpu_time();
77 }
78
79 void aftime(double *t)
80 {
81 asc_assert(NULL != t);
82 *t = tm_cpu_time();
83 }
84
85 void TM_CPU_TIME_FTN(double *t)
86 {
87 asc_assert(NULL != t);
88 *t = tm_cpu_time();
89 }
90
91 void AFTIME(double *t)
92 {
93 asc_assert(NULL != t);
94 *t = tm_cpu_time();
95 }

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