A new customer is asking for the below 2 functionalities:
- Clock Synch Operation allowing all devices to operate on the same time than C8Y so the devices and the platform are in sync
- Force Clock Operation allowing to set a device to a specific time (it can be back-dated compared to platform time). They want this functionality for running some tests on their devices.
I wanted the expert advice to know how to best handle / configure those 2 custom operations.
For the Clock Synch, if I was to send the current C8Y time within the operation, then by the time the device receives the operation, it will be already a few ms/sec behind the current platform time. So that s not going to work.
For the Force Clock Op, I am wondering if this is not going to cause some unforeseen issues to have devices sending back dated data?
I would be really careful here as the requirements sounds like they are already trying to dictate the solution.
Firstly I would highly recommend against trying to implement your own time synchronisation solution…time sync is a hard problem to solve especially across devices. One way to do it would be to look at setting up your own NTP server that you can control, then all of the devices can talk with the NTP server and get their time from it. You will have to look at how large time-jumps are handled by each application, however it should be manageble. Though be aware, this solution will still only be able to control the device’s time and not the Cumulocity Platform’s time…so your mileage might vary.
It might be better to review the “why” behind the requirements first. If one of the reasons “why” is to run integration tests in a time-sped-up environment then simulating “real” time (e.g. 1 second = 1 second) will not be very useful if your testing spans hours…In that case you might what to consider simulating time from within the application itself. This would give you better control over time and ticks (increments of time). But again it really depends on your application, and also what functions you want to test within the application and within Cumulocity IoT.
As platform manager for my company, I wouldn’t want to set that up.
Cumulocity is a great platform. But it’s not an NTP server and it shouldn’t be. There are a LOT of NTP servers out there, freely available. It’s trivial to take devices and synch them that way, whether you set up your own or use one of the available ones.
This also brings up the question of the class of device you have. If you aren’t doing real-time communications, the time the operation occurred is a data point. If you’re using NTP, then that should give you an accurate timestamp for that.
I don’t know this for a fact, but I suspect that Cumulocity is already synching to an NTP server somewhere. If that’s the case, then maybe using the same server (if it’s publicly available) would be an option. Otherwise, at least using the same one for all your devices will help with this to have accurate time.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.