File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 8
8
set -e
9
9
10
10
now () {
11
- date +%s.%N
11
+ date -u +%s.%N
12
12
}
13
13
14
14
duration_since () {
15
15
duration_secs=$( echo " $( now) - $1 " | bc)
16
16
17
- days=$( echo " $duration_secs / 86400" | bc)
18
- remaining_secs=$( echo " $duration_secs - ($days * 86400)" | bc)
19
-
20
- hours=$( echo " $remaining_secs / 3600" | bc)
21
- remaining_secs=$( echo " $remaining_secs - ($hours * 3600)" | bc)
17
+ hours=$( echo " $duration_secs / 3600" | bc)
18
+ remaining_secs=$( echo " $duration_secs - ($hours * 3600)" | bc)
22
19
23
20
mins=$( echo " $remaining_secs / 60" | bc)
24
21
secs=$( echo " $remaining_secs - ($mins * 60)" | bc)
25
22
26
- if [ " $(( mins + hours + days )) " -eq 0 ]; then
23
+ if [ " $(( mins + hours)) " -eq 0 ]; then
27
24
echo " " " $secs " " s"
28
- elif [ " $(( hours + days )) " -eq 0 ]; then
25
+ elif [ " $hours " -eq 0 ]; then
29
26
echo " " " $mins " " m " " $secs " " s"
30
- elif [ " $days " -eq 0 ]; then
31
- echo " " " $hours " " h " " $mins " " m " " $secs " " s"
32
27
else
33
- echo " " " $days " " d " " $ hours" " h " " $mins " " m " " $secs " " s"
28
+ echo " " " $hours " " h " " $mins " " m " " $secs " " s"
34
29
fi
35
30
}
36
31
You can’t perform that action at this time.
0 commit comments