This removes the dependency on Python and as such also removed
Python as a runtime dependency in the `debian/control` file.
I've compared both functions with the following script:
```bash
time_15="2015-07-03T02:39:00.39028499"
time_17="2015-07-03 02:39:00.390284991 +0000 UTC"
function date_parse {
if date --utc >/dev/null 2>&1; then
# GNU/date
echo $(date -u --date "${1}" "+%s")
else
# BSD/date
echo $(date -j -u -f "%F %T" "${1}" "+%s")
fi
}
function elapsed_time() {
# Docker 1.5.0 datetime format is 2015-07-03T02:39:00.390284991
# Docker 1.7.0 datetime format is 2015-07-03 02:39:00.390284991 +0000 UTC
utcnow=$(date -u "+%s")
without_ms="${1:0:19}"
replace_t="${without_ms/T/ }"
epoch=$(date_parse "${replace_t}")
echo $(($utcnow - $epoch))
}
function ElapsedTime {
python <<END
from datetime import datetime,timedelta
now = datetime.utcnow()
exited = datetime.strptime('${1}'[:19].replace("T"," "), "%Y-%m-%d %H:%M:%S")
difference = now - exited
differenceTotalSeconds = difference.seconds + difference.days*24*3600
print(int(differenceTotalSeconds))
END
}
for time in "${time_15}" "${time_17}"; do
echo $(elapsed_time "${time}")
echo $(ElapsedTime "${time}")
done
```
This results in the following output, proving the functions result
in identical behaviour:
```
2219644
2219644
2219644
2219644
```