DotNetDupe
4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Toggle main menu visibility
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
"
10
#include "
System/DateTimeOffset.h
"
11
#include "
System/TimeSpan.h
"
12
#include "
System/SmartPointer.h
"
13
14
namespace
DotNetDupe
{
15
namespace
System
{
16
17
class
TimeProvider
;
18
21
using
TimeProviderPtr
=
SmartPointer<TimeProvider>
;
22
30
class
TimeProvider
:
public
Object
{
31
public
:
33
virtual
~TimeProvider
() =
default
;
34
37
DOTNETDUPE_API
virtual
DateTimeOffset
GetUtcNow
()
const
= 0;
38
41
DOTNETDUPE_API
virtual
DateTimeOffset
GetLocalNow
()
const
= 0;
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
64
DOTNETDUPE_API
static
TimeProviderPtr
GetSystem
();
65
};
66
67
}
68
}
Common.h
Defines common cross-platform macros, export decorators, and fundamental types.
DOTNETDUPE_API
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition
Common.h:20
DateTimeOffset.h
Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Un...
Object.h
Base object class for DotNetDupe mirroring .NET System.Object.
SmartPointer.h
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
TimeSpan.h
Represents a time interval.
DotNetDupe::System::DateTimeOffset
Represents a point in time, typically expressed as a date and time of day, relative to Coordinated Un...
Definition
DateTimeOffset.h:22
DotNetDupe::System::Object
Supports all classes in the DotNetDupe class hierarchy.
Definition
Object.h:18
DotNetDupe::System::SmartPointer
A unified smart pointer that supports both unique and shared ownership semantics.
Definition
SmartPointer.h:72
DotNetDupe::System::TimeProvider
An abstraction that provides time-related functions to enable testability of time-dependent code.
Definition
TimeProvider.h:30
DotNetDupe::System::TimeProvider::GetLocalNow
virtual DateTimeOffset GetLocalNow() const =0
Gets a DateTimeOffset value that is set to the current date and time in the local time zone.
DotNetDupe::System::TimeProvider::GetElapsedTime
TimeSpan GetElapsedTime(int64_t startingTimestamp) const
Gets the elapsed time since the startingTimestamp was recorded.
Definition
TimeProvider.cpp:73
DotNetDupe::System::TimeProvider::GetSystem
static TimeProviderPtr GetSystem()
Gets a TimeProvider that provides the system's current time and high-resolution timer.
Definition
TimeProvider.cpp:84
DotNetDupe::System::TimeProvider::~TimeProvider
virtual ~TimeProvider()=default
Virtual destructor for polymorphic cleanup.
DotNetDupe::System::TimeProvider::GetUtcNow
virtual DateTimeOffset GetUtcNow() const =0
Gets a DateTimeOffset value that is set to the current Coordinated Universal Time (UTC) date and time...
DotNetDupe::System::TimeProvider::GetTimestampFrequency
virtual int64_t GetTimestampFrequency() const =0
Gets the frequency of the high-frequency counter in ticks per second.
DotNetDupe::System::TimeProvider::GetTimestamp
virtual int64_t GetTimestamp() const =0
Gets the current high-frequency counter value in ticks.
DotNetDupe::System::TimeSpan
Represents a time interval (duration of time or elapsed time) measured as a positive or negative numb...
Definition
TimeSpan.h:20
DotNetDupe::System
Definition
Action.h:11
DotNetDupe::System::TimeProviderPtr
SmartPointer< TimeProvider > TimeProviderPtr
Alias for a smart pointer to a TimeProvider.
Definition
TimeProvider.h:21
DotNetDupe
Definition
IServiceCollection.h:7
Include
System
TimeProvider.h
Generated by
1.18.0