Timers

Something that I do, besides programming, is lift weights. Specifically, I train for and compete in kettlebell sport. The training is usually based around doing X-thing for Y-time and so I’ve developed some experience with interval timers.

I didn’t like any of them!

So I built this instead!

I realize that roughly four years ago I wrote “Timer Thing, Part 1” and shortly after I cranked out that article I got busy with something else and abandoned that project. I suppose this is the spiritual successor to that and could rightfully be called “Timer Thing, Part 2.” I eventually finish things I start.

Eventually.

Problems

One of the biggest issues was that, week over week, the kinds of intervals I’d be doing would change. Sometimes it was rest times that got adjusted, sometimes it was work time. Occasionally, both got modified at once. The majority of timers I’ve tried require you to go through a little UI to set this stuff up piecemeal. There was a lot of button pressing on those UIs. There was also a lot of scrolling to see if I had set up that particular timer before so I could re-run it.

There were also advertisements. Yuck.

All of the above annoyed me, and I realized that this could be simplified with a syntax.

Syntax? Why?

You’re on a programmer’s blog, and I tend to think of how I might be able to pack a bunch of information into a string. This is not unlike designing a language. Plus, I think it’s neat.

Initially, I thought that maybe I’d want to crank out a specific syntax and write a compiler for it but that would be ridiculous – I just wanted an excuse to make a small compiler. That approach died an early death when I realized that I wasn’t going to be producing anything executable and so why bother with that level of overhead?

I ultimately settled on string manipulation. It doesn’t look great on the back end where I process this stuff, but I decided that I don’t care. As long as the input is predictable, we can produce a timer from it and that was the start and end of that which I considered important.

So What is This Syntax?

Something to keep in mind is that I had a very specific purpose driving me. I wanted to set up sets of work and rest for training for kettlebell sport. I have no doubt that it will work for just about any timer you can imagine though.

The decision that I had to make was how to notate all of this, and I invented it through simply reading and thinking about descriptions of the workouts of others over the past few years. I don’t know if any one source produced this in my mind, but maybe at some point I ran across this specific syntax design. I don’t know that I can take credit for it, but I sure implemented it.

The gist of it is this (and it isn’t an equation):
SxW’(R’)

I think that deserves an explanation.

First, “S” stands for “sets.” Essentially, this is how many times I want the timer cycles to repeat.

“W” with the single quote following stands for “work in minutes.” This is how long, in minutes, I intend to be engaged in the act of lifting the weight.

The parenthesis and “R” are the rest minutes. The parenthesis are important because I wanted to clearly dictate that this was rest and it communicates a bit of information to the user that is hip to this syntax.

My contention is that this syntax ought to allow you to describe any timer that you can think of. I think that is reasonably powerful.

No Advertisements

I really like applications that load quickly and allow you to get right to the point. Y’know, software that you can use. I like things that look like they take the user into consideration, especially when I am one of the prospective users.

I’ve got it hosted such that it might just explode and become unavailable for a time if everyone tried using it at once. That wouldn’t be optimal. I don’t believe I have enough readership to make that happen, though.

I opened a Ko-Fi account for it and provided a link on the app. It’s there purely to support it if you decide that you really enjoy the timer. I certainly don’t expect it, but I want to do whatever I can to stay away from trying to use ad revenue to pay for anything. I think that’s awful. I’d do it if I had to, though. I can’t even see that as a necessity from where I am at the moment.

Further Considerations

You might’ve noticed that I’m only handling minutes right now. That means that you have to be able to do some decimal work if you want to do seconds for, say, a Tabata timer. I don’t like this and I would like to build in support for seconds in a future update. It’s not that hard; I just have to make time to do it.

I also would like to see if I can’t expand the functionality to help those that might want to use this outside of interval training. After all, timers exist everywhere, not just in the context of working out.

As an Aside

Timers are kind of complicated. I didn’t account for drift in this one, figuring that close enough is perfectly acceptable for now. That might be something I handle later, and it will probably be the topic of another post at some point in the future. Plus whatever salient lessons I learned while working on a timer application.

It certainly isn’t the most complicated thing I’ve ever built, but I think there are some interesting things dwelling in this realm regardless.

Published by Joe

I'm a software developer from Minnesota. I also ride bikes!

Leave a comment