TimeUtil.cs add public static property DateTimeKind defaulted to current value DateTimeKind.Local to allow parsing of .blg from different timezone (#65)

* Update Build.cmd

* Update Build.cmd

* Update Build.cmd

* TimeUtil.cs add static DateTimeKind option defaulted to DateTimeKind.Local. This allows the parsing of a performance counter file created in a different timezone. For performance counter files in azure (utc), setting DateTimeKind.Utc.
This commit is contained in:
Jason Gilbertson 2021-04-05 12:45:11 -04:00 коммит произвёл GitHub
Родитель 1902666bbb
Коммит 1171765138
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -4,10 +4,11 @@ using System;
namespace Tx.Windows
{
// We implemented this in Tx, because the default .Net implementation was too slow
// We should do experiment if we still need it
public sealed class TimeUtil
{
// DateTimeKind option needed for overriding DateTimeKind if parsing
// performance counter blg from different timezone than creation time zone
public static DateTimeKind DateTimeKind {get; set;} = DateTimeKind.Local;
private const Int64 TicksPerMillisecond = 10000;
private const Int64 TicksPerSecond = TicksPerMillisecond * 1000;
private const Int64 TicksPerMinute = TicksPerSecond * 60;
@ -35,7 +36,7 @@ namespace Tx.Windows
public static DateTime FromFileTime(Int64 fileTime)
{
return new DateTime(FileTimeOffset + fileTime, DateTimeKind.Local);
return new DateTime(FileTimeOffset + fileTime, DateTimeKind);
}
}
}