FromTicks()

Namespace ›› System ›› MfTimeSpan ›› Methods ››
Parent Previous Next

FromTicks()

OutputVar := MfTimeSpan.FromTicks(value)

MfTimeSpan.FromTicks(value)

Returns a MfTimeSpan that represents a specified time, where the specification is in units of ticks.

Parameters

value

A number of hours, accurate to the nearest millisecond.
Can be instance of MfInt64, MfInteger or var containing integer.

Returns

Returns an instance of MfTimeSpan object that represents value.

Throws

Throws MfInvalidOperationException if not called as a static method.
Throws MfOverflowException if value is less than MinValue or greater than MaxValue.
Throws MfInvalidCastException if value cannot be cast to MfInt64.

Remarks

Static Method.
The value parameter is converted to milliseconds, which is converted to ticks, and that number of ticks is used to initialize the new MfTimeSpan. Therefore, value will only be considered accurate to the nearest millisecond. Note that, because of the loss of precision of the MfFloat data type, this conversion can cause an MfOverflowException for values that are near to but still in the range of either MinValue or MaxValue.

Example

ts := MfTimeSpan.FromTicks(17955896699785)
varStr := MfString.Format("Time Elapsed is Days:{0}, Hours:{1}, Minutes:{2}, Seconds:{3}, Milliseconds:{4}"
   , ts.Days, ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds)
MsgBox, 64, Time Elapsed, %varStr%
; Time Elapsed is Days:20, Hours:18, Minutes:46, Seconds:29, Milliseconds:669