>> ... given that global variables should generally be avoided.
There are still times when they're needed.

>> ... is this a reasonable approach, with the alarm handler setting a global variable?...