aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/include/Poco/Stopwatch.h
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/poco/Foundation/include/Poco/Stopwatch.h
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/include/Poco/Stopwatch.h')
-rw-r--r--contrib/libs/poco/Foundation/include/Poco/Stopwatch.h216
1 files changed, 108 insertions, 108 deletions
diff --git a/contrib/libs/poco/Foundation/include/Poco/Stopwatch.h b/contrib/libs/poco/Foundation/include/Poco/Stopwatch.h
index 7c8a49f19e..6bc27fc92b 100644
--- a/contrib/libs/poco/Foundation/include/Poco/Stopwatch.h
+++ b/contrib/libs/poco/Foundation/include/Poco/Stopwatch.h
@@ -1,108 +1,108 @@
-//
-// Stopwatch.h
-//
-// Library: Foundation
-// Package: DateTime
-// Module: Stopwatch
-//
-// Definition of the Stopwatch class.
-//
-// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#ifndef Foundation_Stopwatch_INCLUDED
-#define Foundation_Stopwatch_INCLUDED
-
-
-#include "Poco/Foundation.h"
-#include "Poco/Clock.h"
-
-
-namespace Poco {
-
-
-class Foundation_API Stopwatch
- /// A simple facility to measure time intervals
- /// with microsecond resolution.
-{
-public:
- Stopwatch();
- ~Stopwatch();
-
- void start();
- /// Starts (or restarts) the stopwatch.
-
- void stop();
- /// Stops or pauses the stopwatch.
-
- void reset();
- /// Resets the stopwatch.
-
- void restart();
- /// Resets and starts the stopwatch.
-
- Clock::ClockDiff elapsed() const;
- /// Returns the elapsed time in microseconds
- /// since the stopwatch started.
-
- int elapsedSeconds() const;
- /// Returns the number of seconds elapsed
- /// since the stopwatch started.
-
- static Clock::ClockVal resolution();
- /// Returns the resolution of the stopwatch.
-
-private:
- Stopwatch(const Stopwatch&);
- Stopwatch& operator = (const Stopwatch&);
-
- Clock _start;
- Clock::ClockDiff _elapsed;
- bool _running;
-};
-
-
-//
-// inlines
-//
-inline void Stopwatch::start()
-{
- if (!_running)
- {
- _start.update();
- _running = true;
- }
-}
-
-
-inline void Stopwatch::stop()
-{
- if (_running)
- {
- Clock current;
- _elapsed += current - _start;
- _running = false;
- }
-}
-
-
-inline int Stopwatch::elapsedSeconds() const
-{
- return int(elapsed()/resolution());
-}
-
-
-inline Clock::ClockVal Stopwatch::resolution()
-{
- return Clock::resolution();
-}
-
-
-} // namespace Poco
-
-
-#endif // Foundation_Stopwatch_INCLUDED
+//
+// Stopwatch.h
+//
+// Library: Foundation
+// Package: DateTime
+// Module: Stopwatch
+//
+// Definition of the Stopwatch class.
+//
+// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#ifndef Foundation_Stopwatch_INCLUDED
+#define Foundation_Stopwatch_INCLUDED
+
+
+#include "Poco/Foundation.h"
+#include "Poco/Clock.h"
+
+
+namespace Poco {
+
+
+class Foundation_API Stopwatch
+ /// A simple facility to measure time intervals
+ /// with microsecond resolution.
+{
+public:
+ Stopwatch();
+ ~Stopwatch();
+
+ void start();
+ /// Starts (or restarts) the stopwatch.
+
+ void stop();
+ /// Stops or pauses the stopwatch.
+
+ void reset();
+ /// Resets the stopwatch.
+
+ void restart();
+ /// Resets and starts the stopwatch.
+
+ Clock::ClockDiff elapsed() const;
+ /// Returns the elapsed time in microseconds
+ /// since the stopwatch started.
+
+ int elapsedSeconds() const;
+ /// Returns the number of seconds elapsed
+ /// since the stopwatch started.
+
+ static Clock::ClockVal resolution();
+ /// Returns the resolution of the stopwatch.
+
+private:
+ Stopwatch(const Stopwatch&);
+ Stopwatch& operator = (const Stopwatch&);
+
+ Clock _start;
+ Clock::ClockDiff _elapsed;
+ bool _running;
+};
+
+
+//
+// inlines
+//
+inline void Stopwatch::start()
+{
+ if (!_running)
+ {
+ _start.update();
+ _running = true;
+ }
+}
+
+
+inline void Stopwatch::stop()
+{
+ if (_running)
+ {
+ Clock current;
+ _elapsed += current - _start;
+ _running = false;
+ }
+}
+
+
+inline int Stopwatch::elapsedSeconds() const
+{
+ return int(elapsed()/resolution());
+}
+
+
+inline Clock::ClockVal Stopwatch::resolution()
+{
+ return Clock::resolution();
+}
+
+
+} // namespace Poco
+
+
+#endif // Foundation_Stopwatch_INCLUDED