예제 #1
0
        public void FILETIME_ToDateTime_Invoke_ReturnsExpected()
        {
            var ft = new FILETIME()
            {
                dwLowDateTime  = 3680495616u,
                dwHighDateTime = 30812454u
            };

            Assert.Equal(new DateTime(2020, 05, 13, 13, 3, 12), ft.ToDateTime());
        }
예제 #2
0
 /// <summary>Returns a <see cref="string"/> that represents the <see cref="FILETIME"/> instance.</summary>
 /// <param name="ft">The <see cref="FILETIME"/> to convert.</param>
 /// <param name="format">A standard or custom date and time format string. See notes for <a href="https://msdn.microsoft.com/en-us/library/8tfzyc64(v=vs.110).aspx">DateTime.ToString()</a>.</param>
 /// <param name="provider">An object that supplies culture-specific formatting information.</param>
 /// <returns>
 /// A string representation of value of the current <see cref="FILETIME"/> object as specified by <paramref name="format"/> and <paramref name="provider"/>.
 /// </returns>
 public static string ToString(this FILETIME ft, string format, IFormatProvider provider = null) =>
 ft.ToInt64() < 0 ? ft.ToTimeSpan().ToString() : ft.ToDateTime().ToString(format, provider);
예제 #3
0
 /// <summary>Returns a <see cref="string"/> that represents the <see cref="FILETIME"/> instance.</summary>
 /// <param name="ft">The <see cref="FILETIME"/> to convert.</param>
 /// <param name="format">A standard or custom date and time format string. See notes for <a href="https://msdn.microsoft.com/en-us/library/8tfzyc64(v=vs.110).aspx">DateTime.ToString()</a>.</param>
 /// <param name="provider">An object that supplies culture-specific formatting information.</param>
 /// <returns>
 /// A string representation of value of the current <see cref="FILETIME"/> object as specified by <paramref name="format"/> and <paramref name="provider"/>.
 /// </returns>
 public static string ToString(this FILETIME ft, string format, IFormatProvider provider = null) => ft.ToDateTime().ToString(format, provider);