1 of 1 people found this helpful
I guess that your dtTime is DateTime object and utc time.
In my environment, following works fine.
var time = new AFTime("2016/4/6 9:00:00"); var value = new AFValue(100,time); pt.UpdateValue(value, OSIsoft.AF.Data.AFUpdateOption.Replace);
Or if you parse the timestamp as a local timestamp of System.DateTime, it also works. (Of cause you should change "ja-JP" to correct one)
CultureInfo culture = CultureInfo.CreateSpecificCulture("ja-JP"); DateTimeStyles styles = DateTimeStyles.AssumeLocal; DateTime dtTime = DateTime.Parse("2016/4/6 9:00:00",culture,styles); var value = new AFValue(100, dtTime); pt.UpdateValue(value, OSIsoft.AF.Data.AFUpdateOption.Replace);
Could you check above 2 ways?
"value.Timestamp" is an AFTime which by default shows the UTC time while dtTime (type DateTime) shows local time... To validate, simply look at value.Timestamp.LocalTime.
Here is the optimized way to write/replace your new value directly to a PI Point.
pt.UpdateValue(new AFValue(newValue, dtTime), AFUpdateOption.Replace, AFBufferOption.BufferIfPossible);