OFFIS DCMTK
Version 3.6.0
Main Page
Related Pages
Classes
Files
File List
File Members
ofstd
include
dcmtk
ofstd
oftimer.h
1
/*
2
*
3
* Copyright (C) 1997-2010, OFFIS e.V.
4
* All rights reserved. See COPYRIGHT file for details.
5
*
6
* This software and supporting documentation were developed by
7
*
8
* OFFIS e.V.
9
* R&D Division Health
10
* Escherweg 2
11
* D-26121 Oldenburg, Germany
12
*
13
*
14
* Module: ofstd
15
*
16
* Author: Joerg Riesmeier
17
*
18
* Purpose: Class for measurement of time (Header)
19
*
20
* Last Update: $Author: joergr $
21
* Update Date: $Date: 2010-10-14 13:15:50 $
22
* CVS/RCS Revision: $Revision: 1.13 $
23
* Status: $State: Exp $
24
*
25
* CVS/RCS Log at end of file
26
*
27
*/
28
29
30
#ifndef OFTIMER_H
31
#define OFTIMER_H
32
33
#include "dcmtk/config/osconfig.h"
34
#include "dcmtk/ofstd/ofcast.h"
35
36
#ifdef HAVE_WINDOWS_H
37
#include <windows.h>
38
#else
/* UNIX */
39
#include <sys/time.h>
40
#endif
41
42
#define INCLUDE_CSTDDEF
/* For NULL */
43
#include "dcmtk/ofstd/ofstdinc.h"
44
45
46
/*---------------------*
47
* class declaration *
48
*---------------------*/
49
53
class
OFTimer
54
{
55
56
public
:
57
60
OFTimer
()
61
:
Start
(
getTime
())
62
{
63
}
64
67
inline
void
reset
()
68
{
69
Start
=
getTime
();
70
}
71
77
inline
double
getDiff
()
const
78
{
79
return
getTime
() -
Start
;
80
}
81
88
inline
static
double
getDiff
(
double
start)
89
{
90
return
getTime
() - start;
91
}
92
97
inline
static
double
getTime
()
98
{
99
#ifdef HAVE_WINDOWS_H
100
return
OFstatic_cast(
double
, GetTickCount()) / 1000;
101
#else
/* tested on solaris */
102
timeval c_time;
103
gettimeofday(&c_time, NULL);
104
return
OFstatic_cast(
double
, c_time.tv_sec) + OFstatic_cast(
double
, c_time.tv_usec) / 1000000;
105
#endif
106
}
107
108
109
private
:
110
112
double
Start
;
113
};
114
115
116
#endif
117
118
119
/*
120
*
121
* CVS/RCS Log:
122
* $Log: oftimer.h,v $
123
* Revision 1.13 2010-10-14 13:15:50 joergr
124
* Updated copyright header. Added reference to COPYRIGHT file.
125
*
126
* Revision 1.12 2010-03-01 09:08:51 uli
127
* Removed some unnecessary include directives in the headers.
128
*
129
* Revision 1.11 2005-12-08 16:06:10 meichel
130
* Changed include path schema for all DCMTK header files
131
*
132
* Revision 1.10 2003/12/05 10:37:41 joergr
133
* Removed leading underscore characters from preprocessor symbols (reserved
134
* symbols). Updated copyright date where appropriate.
135
*
136
* Revision 1.9 2003/07/09 13:57:43 meichel
137
* Adapted type casts to new-style typecast operators defined in ofcast.h
138
*
139
* Revision 1.8 2001/06/01 15:51:36 meichel
140
* Updated copyright header
141
*
142
* Revision 1.7 2000/03/08 16:36:03 meichel
143
* Updated copyright header.
144
*
145
* Revision 1.6 2000/02/02 10:56:25 joergr
146
* Removed space characters before preprocessor directives.
147
*
148
* Revision 1.5 1999/04/29 13:45:00 joergr
149
* Added DOC++ comments.
150
*
151
* Revision 1.4 1999/04/21 13:01:44 meichel
152
* ofstd/include/oftimer.h
153
*
154
* Revision 1.3 1999/02/05 14:07:23 joergr
155
* Introduced new preprocessor definition HAVE_WINDOWS_H.
156
*
157
* Revision 1.2 1999/01/20 15:56:12 joergr
158
* Minor changes to avoid compiler warnings (gcc 2.8.1 with additional
159
* options).
160
*
161
* Revision 1.1 1999/01/20 14:27:02 joergr
162
* Added class for measurement of time.
163
*
164
*
165
*/
Generated on Thu Dec 20 2012 for
OFFIS DCMTK
Version 3.6.0 by
Doxygen
1.8.2