7 Replies Latest reply on Apr 15, 2016 9:56 AM by gseq RSS
    gseq Apprentice

    Valuestream Timestamp

    I have a value stream taking in values from a remote thing. Data goes out to the server every 10 seconds.

    However the time stamp on my value stream is 4 hours off. Is there a way to set the time on Thingworx Platform.

     

    Eg: From the Valuestream:

     

    2016-04-08 07:48:34

     

     

    125.74

     

     

    1512.50

     

     

    2016-04-08 07:48:24

     

     

    126.40

     

     

    1491.50

     

     

    2016-04-08 07:48:14

     

     

    125.25

     

     

    1470.52

     

     

    The time on my server as well as the remote thing is the same and set to 11:4AM.

     

    Thanks.

      • Re: Valuestream Timestamp
        aanjan Heavyweight Champ

        Gerard, where is this EMS/ SDK located that is connecting to your Remote Thing? Is that in the same timezone as well?

          • Re: Valuestream Timestamp
            gseq Apprentice

            It is in the same time zone(EDT)

            I will double check,

             

            If I do a >Date command on the server, it matches with the Edge.

              • Re: Valuestream Timestamp
                aanjan Heavyweight Champ

                Are you pushing any timestamps or anything related through your EMS or SDK? Is this a custom script or are you using one of the available examples like the Steam Sensor example?

                  • Re: Valuestream Timestamp
                    gseq Apprentice

                    Not pushing timestamps.

                    I'm using a modified version of the SteamSensor code.

                    I can send you a PM with login details.. if you would like to take a look.

                      • Re: Valuestream Timestamp
                        anishi Explorer

                        Hi,

                        If you want to set the time stamp at remote device, it is necessary to use set PropertyVTQ instead of setProperty in Java SDK.


                        Here is my example.

                        ---

                        public void processScanRequest() throws Exception {

                                super.processScanRequest();

                         

                                Double currentTemperatureC = getTemperature();

                         

                                LOG.debug("Prop_Temperature" + "=" + currentTemperatureC);

                                VTQ vtq = new VTQ();

                               vtq.setValue(new NumberPrimitive(currentTemperatureC));

                                vtq.setTime(new DateTime());

                                vtq.setQuality(QualityStatus.GOOD);

                               setPropertyVTQ("Prop_Temperature", vtq, true);

                               

                        //        setProperty("Prop_Temperature", currentTemperatureC); -> This does setting timestamp at the server side, not the remote device.

                               

                                updateSubscribedProperties(1000);

                                // 2000 msec is the value for timeout for the service call

                            }

                         

                        I hope this will help you.

                        Akira

                          • Re: Valuestream Timestamp
                            ianban Creator

                            Unless it's changed recently, Java SDK sends timestamps by default when you use setProperty. The .NET SDK does not and you have to use the VTQ method.

                             

                            ThingWorx stores timestamps in UTC and displays timestamps based on the timezone settings of the client.

                             

                            How are you looking at the contents of the ValueStream? Your profile says you're in Boston. That's 5 hours behind the UK, but it's summer time.. so the UK is 1 hr ahead of UTC. So the four hour difference suggests that you're seeing the "raw" UTC data in the valuestream. If you display the valuestream data in a mashup, does it show Boston time?

                    • Re: Valuestream Timestamp
                      gseq Apprentice

                      Hello All,

                      OP here. Just an update. My edge device has a very old and limited version of linux. The issue was UTC time. My edge device is unable to set time-zones. What we did was move the time forward to 4 hours to match UTC for our TZ. This works for now.

                      Thanks for your replies.