EpcTools
An event based multi-threaded C++ development framework.
etimer.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2009-2019 Brian Waters
3 * Copyright (c) 2019 Sprint
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 
18 #ifndef __etimer_h_included
19 #define __etimer_h_included
20 
22 
23 #include "ebase.h"
24 
26 class ETimer
27 {
28 public:
30  ETimer();
33  ETimer(const ETimer &a);
36  ETimer(const epctime_t t);
38  ~ETimer();
39 
41  Void Start();
43  Void Stop();
46  Void Set(epctime_t a);
49  epctime_t MilliSeconds(Bool bRestart = False);
52  epctime_t MicroSeconds(Bool bRestart = False);
53 
57  ETimer &operator=(const ETimer &a);
61  ETimer &operator=(const epctime_t t);
62 
64  operator epctime_t() { return _time; }
65 
66 private:
67  epctime_t _time;
68  epctime_t _endtime;
69 };
70 
71 #endif // #define __etimer_h_included
ETimer::Set
Void Set(epctime_t a)
Assigns a value to the timer.
Definition: etimer.cpp:75
ETimer::MilliSeconds
epctime_t MilliSeconds(Bool bRestart=False)
Retrieves the current value of the timer in milliseconds.
Definition: etimer.cpp:81
ETimer::Start
Void Start()
Starts the timer.
Definition: etimer.cpp:53
ebase.h
Macros for various standard C library functions and standard includes.
ETimer::Stop
Void Stop()
Stops the timer.
Definition: etimer.cpp:63
ETimer::~ETimer
~ETimer()
Class desctructor.
Definition: etimer.cpp:51
ETimer
Implements a stopwatch style timer.
Definition: etimer.h:26
False
#define False
False.
Definition: ebase.h:27
ETimer::MicroSeconds
epctime_t MicroSeconds(Bool bRestart=False)
Retrieves the current value of the timer in microseconds.
Definition: etimer.cpp:101
ETimer::operator=
ETimer & operator=(const ETimer &a)
Assignment operator.
Definition: etimer.cpp:20
ETimer::ETimer
ETimer()
Default constructor.
Definition: etimer.cpp:34
epctime_t
long long int epctime_t
time typedef
Definition: ebase.h:34