quill
Public Member Functions | List of all members
UserClockSource Class Referenceabstract

Base class that provides a timestamp for log statements based on a user-provided clock source. More...

#include <UserClockSource.h>

Inheritance diagram for UserClockSource:
Inheritance graph
[legend]

Public Member Functions

 UserClockSource (UserClockSource const &)=delete
 
UserClockSourceoperator= (UserClockSource const &)=delete
 
QUILL_NODISCARD virtual QUILL_ATTRIBUTE_HOT uint64_t now () const =0
 Returns time since epoch in nanoseconds. More...
 

Detailed Description

Base class that provides a timestamp for log statements based on a user-provided clock source.

This base class can be derived from to pass a user-generated timestamp to a Logger.

It is particularly useful for simulations or scenarios where time manipulation is necessary, such as simulating time in the past and displaying past timestamps in logs.

Note
The derived class must be thread-safe if the Logger object is used across multiple threads. If a Logger is used within a single thread only, thread safety is not a concern.

Member Function Documentation

◆ now()

QUILL_NODISCARD virtual QUILL_ATTRIBUTE_HOT uint64_t UserClockSource::now ( ) const
pure virtual

Returns time since epoch in nanoseconds.

Returns
The current timestamp in nanoseconds

Implemented in UserClockSourceTest.


The documentation for this class was generated from the following file: