Class TimestampProviderExtensions
- Namespace
- LfrlAnvil.Chrono.Extensions
- Assembly
- LfrlAnvil.Chrono.dll
Contains ITimestampProvider extension methods.
public static class TimestampProviderExtensions
- Inheritance
-
TimestampProviderExtensions
- Inherited Members
Methods
Freeze(ITimestampProvider)
Creates a new frozen ITimestampProvider instance from the given provider
,
using its current Timestamp.
[Pure]
public static ITimestampProvider Freeze(this ITimestampProvider provider)
Parameters
provider
ITimestampProviderSource timestamp provider.
Returns
- ITimestampProvider
New frozen ITimestampProvider instance.
GetDifference(ITimestampProvider, ITimestampProvider)
Calculates an offset between current Timestamp instances of two timestamp providers.
[Pure]
public static Duration GetDifference(this ITimestampProvider provider, ITimestampProvider other)
Parameters
provider
ITimestampProviderSource timestamp provider.
other
ITimestampProviderOther timestamp provider to check.
Returns
GetDifference(ITimestampProvider, Timestamp)
Calculates an offset between the provided timestamp
and the current Timestamp of the given timestamp provider
.
[Pure]
public static Duration GetDifference(this ITimestampProvider provider, Timestamp timestamp)
Parameters
provider
ITimestampProviderSource timestamp provider.
timestamp
TimestampTimestamp to check.
Returns
IsFrozen(ITimestampProvider)
Checks whether or not the given timestamp provider
is frozen.
[Pure]
public static bool IsFrozen(this ITimestampProvider provider)
Parameters
provider
ITimestampProviderTimestamp provider to check.
Returns
- bool
true when
provider
is frozen, otherwise false.
IsInFuture(ITimestampProvider, Timestamp)
Checks whether or not the provided timestamp
is in the future
relative to the given timestamp provider
.
[Pure]
public static bool IsInFuture(this ITimestampProvider provider, Timestamp timestamp)
Parameters
provider
ITimestampProviderSource timestamp provider.
timestamp
TimestampTimestamp to check.
Returns
- bool
true when
timestamp
is in the future, otherwise false.
IsInPast(ITimestampProvider, Timestamp)
Checks whether or not the provided timestamp
is in the past
relative to the given timestamp provider
.
[Pure]
public static bool IsInPast(this ITimestampProvider provider, Timestamp timestamp)
Parameters
provider
ITimestampProviderSource timestamp provider.
timestamp
TimestampTimestamp to check.
Returns
- bool
true when
timestamp
is in the past, otherwise false.
IsNow(ITimestampProvider, Timestamp)
Checks whether or not the provided timestamp
is in the present
relative to the given timestamp provider
.
[Pure]
public static bool IsNow(this ITimestampProvider provider, Timestamp timestamp)
Parameters
provider
ITimestampProviderSource timestamp provider.
timestamp
TimestampTimestamp to check.
Returns
- bool
true when
timestamp
is in the present, otherwise false.