FromMilliseconds()

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

FromMilliseconds()

OutputVar := MfTimeSpan.FromMilliseconds(value)

MfTimeSpan.FromMilliseconds(value)

Returns a MfTimeSpan that represents a specified number of milliseconds, where the specification is accurate to the nearest millisecond.

Parameters

value

A number of hours, accurate to the nearest millisecond.
Can be var containing float or any object that matches IsNumber.

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 MfFloat.

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

; A_TickCount is the number of milliseconds since the computer was rebooted
ts := MfTimeSpan.FromMilliseconds(A_TickCount)
MsgBox % MfString.Format("Computer Uptime is Days:{0}, Hours:{1}, Minutes:{2}, Seconds:{3}"
   , ts.Days, ts.Hours, ts.Minutes, ts.Seconds)