Retriveing DataSlice timestamp ?

Forum Home Forums Development and Integration Retriveing DataSlice timestamp ?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #9282

    Hi Mik,

    I am polling data from RS to MQTT bus using pythonnet (python code call .net api). For now, most part works correctly. But with the Srez objects, I need to retrive their creation time. I am not sure how to do that. With below code, the DataTime property is always 1/1/0001 12:00:00 AM(DateTime.MinValue?). Do the data slices sent over tcp has any timestamp ? Could you show me what is the correct way to retive them (e.g. in .net) ? Thanks.

        def recv_cur_data(self, cnl_ids: list) -> DataSliceClass:
            srez = SrezTableLight.Srez(DateTime.MinValue, cnl_ids)
            if self.srv.ReceiveCurData(srez):
                slice = DataSliceClass(srez)
                return slice
    • This topic was modified 9 months, 4 weeks ago by zzz.


    Current data has not timestamp in assumption that the time is now.
    When new data is coming to an input channel, you can write a timestamp to another input channel and then send it by MQTT.


    Thank you. That worked.

    I used a epoch timestamp formula

    private static long EpochTicks = (new DateTime(1970, 1, 1)).Ticks;
    public static double DateTime2Epoch(DateTime dt){
        return (dt.Ticks - EpochTicks )/ TimeSpan.TicksPerSecond;

    and set channel 65535’s formula to DateTime2Epoch(DateTime.Now)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.