start_time=`date "+%Y-%m-%d %H:%M:%S"`
end_time=`date "+%Y-%m-%d %H:%M:%S"`
duration=`echo $(($(date +%s -d "${end_time}") - $(date +%s -d "${start_time}"))) | awk '{t=split("60 s 60 m 24 h 999 d",a);for(n=1;n<t;n+=2){if($1==0)break;s=$1%a[n]a[n+1]s;$1=int($1/a[n])}print s}'`
vim time_diff.sh
#! /bin/bash
start_time=`date "+%Y-%m-%d %H:%M:%S"`
#To do
sleep 190#To do
end_time=`date "+%Y-%m-%d %H:%M:%S"`duration=`echo $(($(date +%s -d "${end_time}") - $(date +%s -d "${start_time}"))) | awk '{t=split("60 s 60 m 24 h 999 d",a);for(n=1;n<t;n+=2){if($1==0)break;s=$1%a[n]a[n+1]s;$1=int($1/a[n])}print s}'`
echo "time diff : ?$duration"