Tag Info

Hot answers tagged


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


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 ...


It doesn't work because time is a shell keyword. There are external time binaries, but you don't appear to have one installed. This will likely work: nohup bash -c 'time sleep 2'


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))


For this answer, I'll assume that there may be several elements working hard to set your time straight. Since I don't really want to wild-guess about which one is working against you, I'll try and give you an answer which should help you find it yourself instead. On a UNIX system, the clock can typically be set using the stime system call. As things ...


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 ...


You need to write in BIOS, Suppose you want to change date strings to the following string: root@debian:/home/mohsen# date -s "Sat May 23 18:56:59 IRDT 2015" root@debian:/home/mohsen# hwclock -w An first line you set a date, But you need to write in bios, In second line with hwclock -w you write your time in bios.


If you have systemtap installed, which is likely the case on a CentOS system, it's easy to trace any system call system-wide. # cat clock.stp probe nd_syscall.stime, nd_syscall.settimeofday, nd_syscall.clock_settime { printf("process %d (%s) called %s(%s) at %d\n", pid(), execname(), name, argstr, gettimeofday_us()); } # stap clock.stp To ...

Only top voted, non community-wiki answers of a minimum length are eligible