I have a fetch data node grabbing unix time from. http://worldtimeapi.org/api/timezone/Europe/London. All works well, but if the connection is slow, everything grinds to a halt till its finished. How can I fetch it asychronously please ? Ive tried using a spin off event as trigger but doesnt work.
Not really sure what you’re trying to achieve without the composition.
What grinds to a halt ? You mean the rest of the composition gets to a halt ?
But if you’re trying to fetch the date and time, if the connection is slow, what would you want to display then until it’s updated ?
And if it’s date and time you’re fetching, can you not use the built-in date & time nodes ?
Hi both. Thanks for taking the time to reply. Unfortunately cant really share as would expose client details unfortunately which i appreciate doesn’t help. I’m having to use time api as it needs to remember where it is across multiple installations. Its a prize/cash accumulator. My methodology was this
1- check current unix time via api.
2-look up unix time saved from last store via curl -stored on twiget.io
3-subtract the two and work out how much prize has incremented.
The system works well in terms of it being pretty robust .It just checks last save and simple maths gets the prize. Check every 20 secs or so and it counts up. I have sub counters and animations going which all stop as it checks… can take 10 secs or so sometimes so wondered if better way of getting current unix time without whole thing pausing till its checked.
Multiple computers run instances of the Vuo composition.
There is a start date-time at which the prize begins accumulating. This is stored on a server that all composition instances can access.
Each composition instance needs periodically (every ~20 seconds) to check the current date-time, then calculate how much time has elapsed since the start time.
The instances all need to stay in sync with each other, so that they all agree on how much time has elapsed.
I think you’re headed in the right direction in your last comment. Instead of trying to query a web API to get the current time, it would most likely be simpler to just configure all of your computers to use a network time server.
Here’s one approach to calculating the time difference, using Vuo’s date-time nodes. The downsides are that you’ll need to split up the start date-time into parts to feed into Make Date-Time and all of your computers will need to be in the same time zone as the stored start date-time. TimeElapsedSinceStart-local.vuo (4.7 KB)
Here’s another approach that overcomes the drawbacks of the previous one by doing the date calculation in a script with Execute Shell Command. TimeElapsedSinceStart-UTC.vuo (2.6 KB)
Thanks Jaymie. As always… amazing solution ! That gives me something to go on. Like the script execute ! I’m sure it’ll be a lot less resource intensive than my efforts.