Tag Info

New answers tagged


You don't need microseconds resolution, milliseconds will do for about 20 to 60 frames per second. If you you get system time for all Pis from a NTP Server one time, they will be missaligned after some time again, because each internal clock may have an individual error of about 100 ppm (part per million). After 200 seconds you might have a difference of up ...


If you have configured all of the Raspberry Pis to a local NTP Server, i.e. you've set up an NTP Server on your LAN, then their synchronization should be adequate for your video frame timestamping task. Both Bash and Python need to make a system function call to retrieve the system time. There's no advantage in using Bash to make that call. Both Python ...


There's no much point asking for this kind of precision in a shell script, given that running any command (even the date command) will take at least a few hundreds of those microseconds. In particular, you can't really use the date command to time the execution of a command with this kind of precision. For that, best would be to use the time command or ...


As you said date +%s returns the number of seconds since the epoch. So, date +%s%N returns the seconds and the current nanoseconds. Dividing date +%s%N the value by 1000 will give in microseconds.i.e echo $(($(date +%s%N)/1000))


date +%s%N will give the nano seconds since epoch To get the micro seconds just do an eval expr `date +%s%N` / 1000


You might try writing your own gettimeofday() routine, loading it into a compiled library, and using LD_PRELOAD to have your application get a faked time. This should not affect any other applications.


Have you tried to install NTP in your VM and let it take care of that? If you were using VMware the best thing to do would be to install vmware-tools which provides automatic sync of time. However, I don't know whether a similar package exists for VirtualBox.

Top 50 recent answers are included