SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Time.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2009 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 
30 
31 ///
32 ///@file Time.h
33 ///@brief Utility class for dealing with time
34 ///
35 ///@author Steve Parker
36 /// Department of Computer Science
37 /// University of Utah
38 ///@date June 1997
39 ///
40 
41 #ifndef Core_Thread_Time_h
42 #define Core_Thread_Time_h
43 
45 
46 namespace SCIRun {
47 /**************************************
48 
49 @class
50  Time
51 
52  KEYWORDS
53  Thread, Time
54 
55 @details
56  Utility class to manage Time. This class is implemented using
57  high precision counters on the SGI, and standard unix system calls
58  on other machines.
59 
60 ****************************************/
61 class SCISHARE Time {
62 public:
63  typedef long long SysClock;
64 
65  //////////
66  /// Return the current system time, in terms of clock ticks.
67  /// Time zero is at some arbitrary point in the past.
68  static SysClock currentTicks();
69 
70  //////////
71  /// Return the current system time, in terms of seconds.
72  /// This is slower than currentTicks(). Time zero is at
73  /// some arbitrary point in the past.
74  static double currentSeconds();
75 
76  //////////
77  /// Return the conversion from seconds to ticks.
78  static double ticksPerSecond();
79 
80  //////////
81  /// Return the conversion from ticks to seconds.
82  static double secondsPerTick();
83 
84  //////////
85  /// Wait until the specified time in clock ticks.
86  static void waitUntil(SysClock ticks);
87 
88  //////////
89  /// Wait until the specified time in seconds.
90  static void waitUntil(double seconds);
91 
92  //////////
93  /// Wait for the specified time in clock ticks
94  static void waitFor(SysClock ticks);
95 
96  //////////
97  /// Wait for the specified time in seconds
98  static void waitFor(double seconds);
99 
100 private:
101  Time();
102  static void initialize();
103 };
104 } // End namespace SCIRun
105 
106 #endif
107 
108 
long long SysClock
Definition: Time.h:63
#define SCISHARE
Definition: share.h:39
Definition: Time.h:61