implemented infinite backoff (fixes #311767)
[dasher.git] / Src / DasherCore / TimeSpan.h
bloba1cc416b36cd4d9b45e889caa43db8c7311be6de
2 // Object that keeps track of a time span.
3 // Span starts when the object is created, and
4 // ends when someone asks it for its XML representation.
5 // User can also call stop to cause timer to stop and
6 // call for XML representation later.
7 //
8 // Copyright 2005 by Keith Vertanen
10 #ifndef __TIME_SPAN_H__
11 #define __TIME_SPAN_H__
13 #include "FileLogger.h"
14 #include <string>
15 #include "SimpleTimer.h"
16 #include <time.h>
17 #include <vector>
18 #include "XMLUtil.h"
20 using namespace std;
22 extern CFileLogger* g_pLogger;
24 class CTimeSpan;
26 typedef vector<CTimeSpan> VECTOR_TIME_SPAN;
27 typedef vector<CTimeSpan*> VECTOR_TIME_SPAN_PTR;
29 class CTimeSpan
31 public:
32 CTimeSpan(const string& strName, bool bAddDate);
33 CTimeSpan(const string& strName, const string& strXML);
35 ~CTimeSpan();
37 void Stop();
38 string GetXML(const string& strPrefix = "", bool bSinglePointInTime = false);
40 void Continue();
41 bool IsStopped();
42 double GetElapsed();
44 static string GetTimeStamp();
45 static string GetDateStamp();
47 private:
48 string m_strName;
49 string m_strStartTime;
50 string m_strEndTime;
51 double m_dElapsed;
52 CSimpleTimer* m_pTimer;
53 string m_strStartDate;
55 void InitMemberVars();
59 #endif