fix(unitproc):timeDuration: Add missing $ to var, add ver\#
authorSteven Baltakatei Sandoval <baltakatei@gmail.com>
Thu, 2 Jul 2020 19:48:09 +0000 (19:48 +0000)
committerSteven Baltakatei Sandoval <baltakatei@gmail.com>
Thu, 2 Jul 2020 19:48:09 +0000 (19:48 +0000)
unitproc/bktemp-timeDuration

index f132d08bb46d40f5f75c517e43b84f2e919d12f2..090b485bede06e236e491bdd1970367ca8a28610 100644 (file)
@@ -10,12 +10,17 @@ timeDuration(){
     # Ref/Attrib: ISO-8601:2004(E), §4.4.4.2 Representations of time intervals by duration and context information
     # Note: "1 month" ("P1M") is assumed to be "30 days" (see ISO-8601:2004(E), §2.2.1.2)
     # Usage: timeDuration [arg1] ([arg2])
+    # Version: 1.0.0
     # Input: arg1: seconds as base 10 integer >= 0  (ex: 3601)
     #        arg2: precision level (optional; default=2)
     # Output: stdout: ISO-8601 duration string (ex: "P1H1S", "P2Y10M15DT10H30M20S")
     # Example: 'timeDuration 111111 3' yields 'P1DT6H51M'
-    # Depends: date 8 (gnucoreutils)
-    local returnState fullHours fullMinutes fullSeconds;
+    # Depends: date 8 (gnucoreutils), yell, 
+    local returnState ARG1 ARG2 arg1Valid arg2Valid remainder precision witherPrecision
+    local fullYears fullMonths fullDays fullHours fullMinutes fullSeconds
+    local displayYears displayMonths displayDays displayHours displayMinutes displaySeconds
+    local hasYears hasMonths hasDays hasHours hasMinutes hasSeconds
+    
     ARG1="$1";
     ARG2="$2";
     precision=2; # set default precision
@@ -44,7 +49,7 @@ timeDuration(){
     # Consider whether arg2 was provided
     if  [[ $# -eq 2 ]]; then
        # Check that the second arg is a positive integer
-       if [[ "$ARG2" =~ ^[[:digit:]]+$ ]] && [[ "ARG2" -gt 0 ]]; then
+       if [[ "$ARG2" =~ ^[[:digit:]]+$ ]] && [[ "$ARG2" -gt 0 ]]; then
        arg2Valid="true";
        precision="$ARG2";
        else