feat(archive):Add baltakatei pgp signing public key
[BK-2020-03.git] / unitproc / bktemp-secondsUntilMidnight
1 #!/bin/bash
2
3 # Desc: Template to check that apps, files, or dirs exist.
4 # Author: Steven Baltaktei Sandoval
5 # License: GPLv3+
6
7 #==BEGIN Define script parameters==
8 #===BEGIN Declare local script functions===
9 timeUntilMidnight(){
10 # Desc: Report seconds until midnight
11 # Output: stdout: seconds until midnight
12 TIME_CURRENT="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second.
13 TIME_CURRENT_SHORT="$(date -d "$TIME_CURRENT" +%Y%m%dT%H%M%S%z)" # Produce separator-less current timestamp with resolution 1 second.
14 DATE_CURRENT="$(date -d "$TIME_CURRENT" --iso-8601=date)" ; # Produce `date`-parsable current timestamp with resolution of 1 day.
15 DATE_CURRENT_SHORT="$(date -d "$TIME_CURRENT" +%Y%m%d)" ; # Produce separator-less current timestamp with resolution 1 day.
16 DATE_TOMORROW="$(date -d "$TIME_CURRENT next day" --iso-8601=date)" ; # Produce timestamp of tomorrow's date (res. 1 day).
17 TIME_NEXT_MIDNIGHT="$(date -d "$DATE_TOMORROW" --iso-8601=seconds)" ; # Produce `date`-parsable timestamp of closest future midnight (res. 1 second).
18 SECONDS_UNTIL_NEXT_MIDNIGHT="$(( $(date +%s -d "$TIME_NEXT_MIDNIGHT") - $(date +%s -d "$TIME_CURRENT") ))" ; # Calculate seconds until closest future midnight (res. 1 second).
19 echo "$SECONDS_UNTIL_NEXT_MIDNIGHT" 2>/dev/null;
20 } # Report seconds until next midnight
21 #===END Declare local script functions===
22 #==END Define script parameters==
23
24
25 #==BEGIN sample code==
26 echo "Time until next midnight (seconds):$(timeUntilMidnight)"
27 #==END sample code==