DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
TimeProvider.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "Common.h"
9#include "System/Object.h"
11#include "System/TimeSpan.h"
12#include "System/SmartPointer.h"
13
14namespace DotNetDupe {
15 namespace System {
16
17 class TimeProvider;
18
22
30 class TimeProvider : public Object {
31 public:
33 virtual ~TimeProvider() = default;
34
38
42
45 DOTNETDUPE_API virtual int64_t GetTimestamp() const = 0;
46
49 DOTNETDUPE_API virtual int64_t GetTimestampFrequency() const = 0;
50
54 DOTNETDUPE_API TimeSpan GetElapsedTime(int64_t startingTimestamp) const;
55
60 DOTNETDUPE_API TimeSpan GetElapsedTime(int64_t startingTimestamp, int64_t endingTimestamp) const;
61
65 };
66
67 }
68}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Un...
Base object class for DotNetDupe mirroring .NET System.Object.
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
Represents a time interval.
Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Un...
Supports all classes in the DotNetDupe class hierarchy.
Definition Object.h:18
A unified smart pointer that supports both unique and shared ownership semantics.
An abstraction that provides time-related functions to enable testability of time-dependent code.
virtual DateTimeOffset GetLocalNow() const =0
Gets a DateTimeOffset value that is set to the current date and time in the local time zone.
TimeSpan GetElapsedTime(int64_t startingTimestamp) const
Gets the elapsed time since the startingTimestamp was recorded.
static TimeProviderPtr GetSystem()
Gets a TimeProvider that provides the system's current time and high-resolution timer.
virtual ~TimeProvider()=default
Virtual destructor for polymorphic cleanup.
virtual DateTimeOffset GetUtcNow() const =0
Gets a DateTimeOffset value that is set to the current Coordinated Universal Time (UTC) date and time...
virtual int64_t GetTimestampFrequency() const =0
Gets the frequency of the high-frequency counter in ticks per second.
virtual int64_t GetTimestamp() const =0
Gets the current high-frequency counter value in ticks.
Represents a time interval (duration of time or elapsed time) measured as a positive or negative numb...
Definition TimeSpan.h:20
SmartPointer< TimeProvider > TimeProviderPtr
Alias for a smart pointer to a TimeProvider.