Timestamps

Comments & issues
Post Reply
syberspaz
Fresh meat
Posts: 2
Joined: Fri Mar 23, 2018 8:59 am
Contact:

Timestamps

Post by syberspaz »

Hi, I am using a series of sensors (sound, light, pressure, temperature, humidity) attached to a small PC and using the bonjour network server to connect to these from a separate PC remotely. I'm logging the data on the remote PC for my application but I need to get accurate timestamps of when the data was recorded by the sensor.

What's the best way to do this? Is there a way to get the timestamps from the sensors themselves or does the network server provide a timestamp?

Thanks in advance for any help,

-- Andrew
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Timestamps

Post by mparadis »

The only sensors that have time tracking built-in to the library are the spatial objects (Accelerometer, Magnetometer, Gyroscope). For everything else, you can just get the system time in the data event handler using the appropriate command for that language (for example, DateTime.Now in C# or Date() in JavaScript)
syberspaz
Fresh meat
Posts: 2
Joined: Fri Mar 23, 2018 8:59 am
Contact:

Re: Timestamps

Post by syberspaz »

right, but if I needed the timestamp prior to sending the data over the network server....? The system time on the remote PC will include the network latency and I need to be more accurate than this....
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Timestamps

Post by mparadis »

Unfortunately, since the firmware on the board isn't set up to handle timing, there's not much you can do about network latency. You could have a Phidgets program running on the local machine and then communicate the data and accurate timestamp to the remote computer via entries in a Phidget dictionary or some other means of passing data between the two.

It's worth noting that even if you do this, the maximum data rate on USB is one packet every 8ms, so even if your device data rate is set to 1ms, you'd get all eight events on the 8ms mark and the system time could be off by as much as 7ms.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests