aboutsummaryrefslogtreecommitdiff
path: root/core/lap
blob: 3c51c0c1b24bda0e524139b6b0a2c255d07703e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
[ "$1" = "info" ] && echo "calculate lap duration" && exit 2

lap="$1"
break_rule() {
	break_interval=$1
	break_duration=$2
	if [ $(( $lap % $break_interval )) -eq $(( $break_interval - 1 )) ] ; then
		echo $break_duration
		exit 0
	fi
}

break_rule 6 $(( 15 * 60 )) # every 6th lap (every 3rd break) is a 15 minute break
break_rule 2 $((  5 * 60 )) # every 2nd lap is a 5 minute break
echo         $(( 25 * 60 )) # every other lap is a normal 25 minute lap