• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. _module-pw_chrono_stl:
2
3-------------
4pw_chrono_stl
5-------------
6.. pigweed-module::
7   :name: pw_chrono_stl
8
9``pw_chrono_stl`` is a collection of ``pw_chrono`` backends that are implemented
10using STL's ``std::chrono`` library.
11
12SystemClock backend
13-------------------
14The STL based ``pw_chrono_stl:system_clock`` backend target implements the
15``pw_chrono:system_clock`` facade by using the ``std::chrono::steady_clock``.
16Note that the ``std::chrono::system_clock`` cannot be used as this is not always
17a monotonic clock source.
18
19See the documentation for ``pw_chrono`` for further details.
20
21SystemTimer backend
22-------------------
23The STL based ``pw_chrono_stl:system_timer`` backend target implements the
24``pw_chrono:system_timer`` facade by spawning a detached thread for every single
25``InvokeAt()`` and ``InvokeAfter()`` call. This thread simply sleeps until the
26desired ``expiration_deadline`` and invokes the user's ``ExpiryCallback`` if it
27wasn't cancelled.
28
29.. Warning::
30  Although fully functional, the current implementation is NOT efficient!
31
32See the documentation for ``pw_chrono`` for further details.
33
34Build targets
35-------------
36The GN build for ``pw_chrono_stl`` has one target: ``system_clock``.
37The ``system_clock`` target provides the
38``pw_chrono_backend/system_clock_config.h`` and
39``pw_chrono_backend/system_clock_inline.h`` headers and the backend for the
40``pw_chrono:system_clock``.
41