Fix dateTime bug

This commit is contained in:
Фролов 2021-12-24 11:42:23 +05:00
parent 889a8a8757
commit 24c0ba5e16

View File

@ -88,9 +88,15 @@ namespace AsbCloudInfrastructure.Services
foreach (var oldReq in oldRequests)
{
var telemetryStat = telemetriesStats.GetOrAdd(oldReq.Uid, (uid) => new TrackerStat { RemoteUid = uid });
telemetryStat.TelemetryDateMin = oldReq.DateMin;
telemetryStat.TelemetryDateMax = oldReq.DateMax;
telemetryStat.LastTimeServer = oldReq.DateMax;
var dateMin = oldReq.DateMin.Kind == DateTimeKind.Local
? oldReq.DateMin.ToUniversalTime()
: oldReq.DateMin;
var dateMax = oldReq.DateMax.Kind == DateTimeKind.Local
? oldReq.DateMax.ToUniversalTime()
: oldReq.DateMax;
telemetryStat.TelemetryDateMin = dateMin;
telemetryStat.TelemetryDateMax = dateMax;
telemetryStat.LastTimeServer = dateMax;
}
}).ContinueWith((t) =>
{
@ -123,7 +129,7 @@ namespace AsbCloudInfrastructure.Services
stat.LastTimeServer = DateTime.Now;
if(stat.TelemetryDateMax < remoteDate)
if(stat.TelemetryDateMax.ToUniversalTime() < remoteDate.ToUniversalTime())
stat.TelemetryDateMax = remoteDate;
}