zzz_evobackup: Make start_time and stop_time compatible with OpenBSD

This commit is contained in:
Jérémy Dubois 2022-04-13 17:08:38 +02:00
parent 5cbc2cbf42
commit 1efca713c0
2 changed files with 10 additions and 3 deletions

View file

@ -16,8 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
* Make start_time and stop_time compatible with OpenBSD
### Security
## [22.03]
Split client and server parts of the project
Split client and server parts of the project

View file

@ -505,8 +505,13 @@ fi
STOP_EPOCH=$(/bin/date +%s)
start_time=$(/bin/date --date="@${START_EPOCH}" +"${DATE_FORMAT}")
stop_time=$(/bin/date --date="@${STOP_EPOCH}" +"${DATE_FORMAT}")
if [ "${SYSTEM}" = "openbsd" ]; then
start_time=$(/bin/date -f "%s" -j "${START_EPOCH}" +"${DATE_FORMAT}")
stop_time=$(/bin/date -f "%s" -j "${STOP_EPOCH}" +"${DATE_FORMAT}")
else
start_time=$(/bin/date --date="@${START_EPOCH}" +"${DATE_FORMAT}")
stop_time=$(/bin/date --date="@${STOP_EPOCH}" +"${DATE_FORMAT}")
fi
duration=$(( STOP_EPOCH - START_EPOCH ))
log "STOP GLOBAL - start='${start_time}' stop='${stop_time}' duration=${duration}s"