Page 1 of 1

Timestamps

Posted: Fri Mar 23, 2018 9:04 am
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

Re: Timestamps

Posted: Fri Mar 23, 2018 9:11 am
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)

Re: Timestamps

Posted: Fri Mar 23, 2018 9:12 am
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....

Re: Timestamps

Posted: Fri Mar 23, 2018 9:39 am
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.