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
providerITimestampProviderSource 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
providerITimestampProviderSource timestamp provider.
otherITimestampProviderOther 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
providerITimestampProviderSource timestamp provider.
timestampTimestampTimestamp to check.
Returns
IsFrozen(ITimestampProvider)
Checks whether or not the given timestamp provider is frozen.
[Pure]
public static bool IsFrozen(this ITimestampProvider provider)
Parameters
providerITimestampProviderTimestamp provider to check.
Returns
- bool
true when
provideris 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
providerITimestampProviderSource timestamp provider.
timestampTimestampTimestamp to check.
Returns
- bool
true when
timestampis 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
providerITimestampProviderSource timestamp provider.
timestampTimestampTimestamp to check.
Returns
- bool
true when
timestampis 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
providerITimestampProviderSource timestamp provider.
timestampTimestampTimestamp to check.
Returns
- bool
true when
timestampis in the present, otherwise false.