public static string ToElapsedTimeString(
this TimeSpan value,
int secondPrecision = 2,
string[]? timeNames = null,
double minimumSubSecondResolution = 0.001
)
<ExtensionAttribute>
Public Shared Function ToElapsedTimeString (
value As TimeSpan,
Optional secondPrecision As Integer = 2,
Optional timeNames As String() = Nothing,
Optional minimumSubSecondResolution As Double = 0.001
) As String
public:
[ExtensionAttribute]
static String^ ToElapsedTimeString(
TimeSpan value,
int secondPrecision = 2,
array<String^>^ timeNames = nullptr,
double minimumSubSecondResolution = 0.001
)
Gemstone.TimeSpanExtensions.TimeSpanExtensions.ToElapsedTimeString = function(value, secondPrecision, timeNames, minimumSubSecondResolution);
Set secondPrecision to -1 to suppress seconds display, this will force minimum resolution of time display to minutes.
timeNames array needs one string entry for each of the following names:
" year", " years", " day", " days", " hour", " hours", " minute", " minutes", " second", " seconds", "less than ".
DateTime g_start = DateTime.UtcNow;
DateTime EndTime = DateTime.UtcNow;
TimeSpan duration = EndTime.Subtract(g_start);
Console.WriteLine("Elapsed Time = " + duration.ToElapsedTimeString());
ArgumentOutOfRangeException | minimumSubSecondResolution is not less than or equal to Milli or minimumSubSecondResolution is not defined in Factors array. |