Matthew Lincoln
2008-06-01 06:21:31 UTC
In a shell script I would like to calculate the difference between two timestamps.
It should look like similar to:
mystart=`date`
....
do something
....
myend=`date`
elapsed=calcdiff($mystart, $myend)
echo elapsed time=$(elapsed +%d:%H:%M:%S)
However the script above does not work.
Further question when the runtime is greater than 31 days does %d above then contain e.g. "35"
or does it contain a value modulo 31 (here: 4) ?
Matthew
It should look like similar to:
mystart=`date`
....
do something
....
myend=`date`
elapsed=calcdiff($mystart, $myend)
echo elapsed time=$(elapsed +%d:%H:%M:%S)
However the script above does not work.
Further question when the runtime is greater than 31 days does %d above then contain e.g. "35"
or does it contain a value modulo 31 (here: 4) ?
Matthew