diff --git a/IoTSharp.Data/RawMsg.cs b/IoTSharp.Data/RawMsg.cs index c2261ae45ebd440fb77705990ea02626a2d6a175..c546f8b99d2a8131587a812372a53efdac78714e 100644 --- a/IoTSharp.Data/RawMsg.cs +++ b/IoTSharp.Data/RawMsg.cs @@ -26,7 +26,7 @@ namespace IoTSharp.Data public class RawMsg { public MsgType MsgType { get; set; } - public DateTime ts { get; set; } + public DateTime ts { get; set; } = DateTime.Now; public DeviceStatus DeviceStatus { get; set; } = DeviceStatus.Good; public Guid DeviceId { get; set; } public Dictionary MsgBody { get; set; } diff --git a/IoTSharp/Storage/InfluxDBStorage.cs b/IoTSharp/Storage/InfluxDBStorage.cs index d64cfbd1ca5320dc37a161f22d9f22d6ae946623..9688dae334e3f794ffedfd54921e48ca1c1c4d22 100644 --- a/IoTSharp/Storage/InfluxDBStorage.cs +++ b/IoTSharp/Storage/InfluxDBStorage.cs @@ -227,7 +227,7 @@ from(bucket: ""{_bucket}"") } if (point.HasFields()) { - point = point.Timestamp(msg.ts , WritePrecision.Ns); + point = point.Timestamp(msg.ts.ToUniversalTime() , WritePrecision.Ns); lst.Add(point); telemetries.Add(tdata); }