#!/bin/sh

case $1 in
    stop) rm -f /tmp/timer.txt \
            && echo stopped
    ;;
    *) [ -f /tmp/timer.txt ] \
            && echo $(( $(date +%s) - $(</tmp/timer.txt) )) \
            || ( date +%s > /tmp/timer.txt && echo started )
    ;;
esac
