using date time instead of unixtime

This commit is contained in:
atef 2023-10-23 11:05:18 +02:00
parent 1654d6f4dd
commit 66f6fbb878
1 changed files with 4 additions and 5 deletions

View File

@ -16,7 +16,6 @@ using InnovEnergy.Lib.Devices.Trumpf.TruConvertAc.DataTypes;
using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc;
using InnovEnergy.Lib.Devices.Trumpf.TruConvertDc.Control;
using InnovEnergy.Lib.Protocols.Modbus.Channels;
using InnovEnergy.Lib.Time.Unix;
using InnovEnergy.Lib.Units;
using InnovEnergy.Lib.Utils;
using static InnovEnergy.Lib.Devices.Trumpf.SystemControl.DataTypes.SystemConfig;
@ -170,7 +169,7 @@ internal static class Program
await Observable
.Interval(UpdateInterval)
.Select(_ => RunIteration())
.SelectMany(r => UploadCsv(r, UnixTime.Now.RoundTo(UpdateInterval)))
.SelectMany(r => UploadCsv(r, DateTime.Now.Round(UpdateInterval)))
.SelectError()
.ToTask();
}
@ -216,7 +215,7 @@ internal static class Program
record.ControlConstants();
record.ControlSystemState();
$"{UnixTime.Now} : {record.StateMachine.State}: {record.StateMachine.Message}".WriteLine().LogInfo();
$"{DateTime.Now.ToUnixTime()} : {record.StateMachine.State}: {record.StateMachine.Message}".WriteLine().LogInfo();
var essControl = record.ControlEss().WriteLine().LogInfo();
@ -344,14 +343,14 @@ internal static class Program
sc.ResetAlarmsAndWarnings = true;
}
private static async Task<Boolean> UploadCsv(StatusRecord status, UnixTime timeStamp)
private static async Task<Boolean> UploadCsv(StatusRecord status, DateTime timeStamp)
{
var s3Config = status.Config.S3;
var csv = status.ToCsv().LogInfo();
if (s3Config is null)
return false;
var s3Path = timeStamp + ".csv";
var s3Path = timeStamp.ToUnixTime() + ".csv";
var request = s3Config.CreatePutRequest(s3Path);
var response = await request.PutAsync(new StringContent(csv));