aboutsummaryrefslogtreecommitdiff
path: root/core/lap
diff options
context:
space:
mode:
Diffstat (limited to 'core/lap')
-rwxr-xr-xcore/lap17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/lap b/core/lap
new file mode 100755
index 0000000..3c51c0c
--- /dev/null
+++ b/core/lap
@@ -0,0 +1,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
+