/// <summary> /// Answers a time span between the specified timeout and the current moment expressed in milliseconds. /// </summary> /// <param name="timeout">The timeout.</param> /// <returns>A time span between the specified timeout and the current moment expressed in milliseconds.</returns> public static int GetMillisecondsLeft(int timeout) { int millisecondsLeft = GenuineUtility.CompareTickCounts(timeout, GenuineUtility.TickCount); if (millisecondsLeft < 0) { millisecondsLeft = 0; } return(millisecondsLeft); }
/// <summary> /// Gets a HostInformation representing the remote host where the specified marshalByRefObject resides. /// </summary> /// <param name="marshalByRefObject">The transparent proxy.</param> /// <returns>HostInformation representing the remote host where the specified marshalByRefObject resides.</returns> public static HostInformation FetchHostInformationFromMbr(MarshalByRefObject marshalByRefObject) { string uri; ITransportContext iTransportContext; GenuineUtility.FetchChannelUriFromMbr(marshalByRefObject, out uri, out iTransportContext); string ignored; return(iTransportContext.KnownHosts.Get(GenuineUtility.Parse(uri, out ignored))); }
/// <summary> /// Answers a moment at which the specified time span expires. /// </summary> /// <param name="timespan">The time span in milliseconds.</param> /// <returns>A moment at which the specified time span expires.</returns> public static int GetTimeout(TimeSpan timespan) { return(TickCount + GenuineUtility.ConvertToMilliseconds(timespan)); }