Core - Migrate from CefTime to CefBaseTime (CefNavigationEntry)

- Add new method to convert from CefBaseTime to DateTime

Issue #4234
This commit is contained in:
Alex Maitland
2022-09-06 14:20:53 +10:00
parent 4d78c70793
commit 5f73ce568b
2 changed files with 15 additions and 6 deletions
@@ -300,12 +300,7 @@ namespace CefSharp
return gcnew NavigationEntry(current, DateTime::MinValue, nullptr, -1, nullptr, nullptr, (TransitionType)-1, nullptr, false, false, sslStatus);
}
//TODO: Issue #4234
auto baseTime = entry->GetCompletionTime();
CefTime time;
cef_time_from_basetime(baseTime, &time);
DateTime completionTime = CefTimeUtils::ConvertCefTimeToDateTime(time.GetDoubleT());
DateTime completionTime = CefTimeUtils::FromBaseTimeToDateTime(entry->GetCompletionTime().val);
auto ssl = entry->GetSSLStatus();
X509Certificate2^ sslCertificate;
+14
View File
@@ -32,6 +32,20 @@ namespace CefSharp.Internals
return DateTime.FromFileTime(val * 10);
}
/// <summary>
/// Converts from CefBaseTime to DateTime
/// </summary>
/// <param name="val">
/// Represents a wall clock time in UTC. Values are not guaranteed to be monotonically
/// non-decreasing and are subject to large amounts of skew. Time is stored internally
/// as microseconds since the Windows epoch (1601).
/// </param>
/// <returns>returns a <see cref="DateTime"/> of <see cref="DateTimeKind.Local"/></returns>
public static DateTime FromBaseTimeToDateTime(long val)
{
return DateTime.FromFileTime(val * 10);
}
public static DateTime ConvertCefTimeToDateTime(double epoch)
{
if (epoch == 0)