ping with timestamp

I couldn’t work out a way to get ping to print a timestamp of when the ping took place. For some reason it seems as though this isn’t a sought after feature.

Luckily you can achieve the same thing using fping:

while [ 1 ] ; do echo $(date '+%F %T') $(fping -e google.com); sleep 1; done

Gives the following output:

2008-03-18 11:06:54 google.com is alive (250 ms)
2008-03-18 11:06:56 google.com is alive (248 ms)
2008-03-18 11:06:57 google.com is alive (268 ms)
2008-03-18 11:06:58 google.com is alive (250 ms)
2008-03-18 11:07:00 google.com is alive (250 ms)