/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Example 1:
*
- * coarse_stop_watch<std::seconds> watch;
+ * coarse_stop_watch<std::chrono::seconds> watch;
* do_something();
- * std::cout << "time elapsed: " << watch.elapsed() << std::endl;
+ * std::cout << "time elapsed: " << watch.elapsed().count() << std::endl;
*
* auto const ttl = 60_s;
* if (watch.elapsed(ttl)) {
return true;
}
+ /**
+ * Returns the current checkpoint
+ */
+ typename clock_type::time_point getCheckpoint() const {
+ return checkpoint_;
+ }
+
private:
typename clock_type::time_point checkpoint_;
};
*
* Example:
*
- * coarse_stop_watch<std::seconds> watch;
+ * coarse_stop_watch<std::chrono::seconds> watch;
* do_something();
- * std::cout << "time elapsed: " << watch.elapsed() << std::endl;
+ * std::cout << "time elapsed: " << watch.elapsed().count() << std::endl;
*
* @author: Marcelo Juchem <marcelo@fb.com>
*/
*
* Example:
*
- * stop_watch<std::seconds> watch;
+ * stop_watch<std::chrono::seconds> watch;
* do_something();
- * std::cout << "time elapsed: " << watch.elapsed() << std::endl;
+ * std::cout << "time elapsed: " << watch.elapsed().count() << std::endl;
*
* @author: Marcelo Juchem <marcelo@fb.com>
*/
template <typename Duration = monotonic_clock::duration>
using stop_watch = custom_stop_watch<monotonic_clock, Duration>;
-}
+} // namespace folly