X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/e9332c6447b2b6cd413e1d66d281786810e988f3..cdf058f49da79511145631f9c64e635dce7852a7:/unitproc/bktemp-dateTimeShort diff --git a/unitproc/bktemp-dateTimeShort b/unitproc/bktemp-dateTimeShort index cabb4ba..2a31d1f 100644 --- a/unitproc/bktemp-dateTimeShort +++ b/unitproc/bktemp-dateTimeShort @@ -8,33 +8,33 @@ try() { "$@" || die "cannot $*"; } #o dateTimeShort(){ # Desc: Timestamp without separators (YYYYmmddTHHMMSS+zzzz) # Usage: dateTimeShort ([str date]) - # Version 1.1.0 + # Version 1.1.1 # Input: arg1: 'date'-parsable timestamp string (optional) # Output: stdout: timestamp (ISO-8601, no separators) # Depends: yell - local TIME_CURRENT TIME_CURRENT_SHORT + local argTime timeCurrent timeInput timeCurrentShort argTime="$1"; # Get Current Time - TIME_CURRENT="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second. + timeCurrent="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second. # Decide to parse current or supplied date ## Check if time argument empty if [[ -z "$argTime" ]]; then ## T: Time argument empty, use current time - TIME_INPUT="$TIME_CURRENT"; + timeInput="$timeCurrent"; else ## F: Time argument exists, validate time if date --date="$argTime" 1>/dev/null 2>&1; then ### T: Time argument is valid; use it - TIME_INPUT="$argTime"; + timeInput="$argTime"; else ### F: Time argument not valid; exit yell "ERROR:Invalid time argument supplied. Exiting."; exit 1; fi fi # Construct and deliver separator-les date string - TIME_CURRENT_SHORT="$(date -d "$TIME_INPUT" +%Y%m%dT%H%M%S%z)"; - echo "$TIME_CURRENT_SHORT"; + timeCurrentShort="$(date -d "$timeInput" +%Y%m%dT%H%M%S%z)"; + echo "$timeCurrentShort"; } # Get YYYYmmddTHHMMSS±zzzz #==BEGIN sample code==