DateTimeExtensionsTimeIsValid Method

Determines if time is valid, by comparing it to the specified current time.

Definition

Namespace: Gemstone.DateTimeExtensions
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.110 -- Release Build+3e0464f4461df4d3e1175b13966eb47ff832554d
public static bool TimeIsValid(
	this DateTime testTime,
	DateTime currentTime,
	double lagTime,
	double leadTime
)

Parameters

testTime  DateTime
Time to test for validity.
currentTime  DateTime
Specified current time (e.g., could be Date.Now or Date.UtcNow).
lagTime  Double
The allowed lag time, in seconds, before assuming time is too old to be valid.
leadTime  Double
The allowed lead time, in seconds, before assuming time is too advanced to be valid.

Return Value

Boolean
True, if time is within the specified range.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

Time is considered valid if it exists within the specified lag time/lead time range of current time.

Note that lag time and lead time must be greater than zero, but can be set to sub-second intervals.

Exceptions

ArgumentOutOfRangeExceptionLagTime and LeadTime must be greater than zero, but can be less than one.

See Also