cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Valuestream Timestamp

gseq
2-Guest

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ibanham
1-Newbie
(To:anishi)

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?

View solution in original post

7 REPLIES 7
Aanjan
9-Granite
(To:gseq)

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

gseq
2-Guest
(To:Aanjan)

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.

Aanjan
9-Granite
(To:gseq)

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?

gseq
2-Guest
(To:Aanjan)

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.

anishi
13-Aquamarine
(To:gseq)

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

ibanham
1-Newbie
(To:anishi)

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?

gseq
2-Guest
(To:Aanjan)

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.

Top Tags