A C++ Stopwatch Class, Daylight Saving, and SpicyNodes

CHAIN of actions. A component of my Master’s thesis will involve translating some MATLAB code to C++. The MATLAB code includes a check for whether an iterative process is taking too long, in which case it quits. So, I wanted to download a simple C++ stopwatch class implementation. I Googled “stopwatch class” , and thought that the Code Project’s stopwatch implementation seemed to fit the bill.

Interestingly, the National Center for Biotechnology Information has their own C++ stopwatch class implementation. I would’ve used it since it was consistent with my bioinformatics theme, but unfortunately the NCBI stopwatch seems to depend on another class called a SmartString, which deterred me; I wanted something self-contained. (Not sure where SmartString comes from. Is that NCBI stuff? Or is it in the Standard Template Library?) My problem was, suppose I went ahead and downloaded the class for a SmartString. I might then be faced with yet another dependency, and have to download other stuff: a recursive chain of dependencies with an uncertain terminus. (Maybe I could use a stopwatch, and if it took too long to download all the recursive dependencies I could quit the process. 🙂 ) The Code Project’s stopwatch implementation, on the other hand, seemed to be short, light-weight, and self-contained; this reduces the variability of whether I can get the code to work or not. Maybe I’ll check out the NCBI code later, but right now my main concern is translating MATLAB code to C++ ASAP.

As I’ve gotten older I’ve come to appreciate the wisdom of the K.I.S.S. Principle.

So I proceeded to download the Code Project‘s stopwatch class, and to do this I had to register. And one of the questions upon registration was whether I was currently in Daylight Saving Time. I wasn’t sure! I mean, I know that we set the clock back in the fall, and then forward in the spring (“spring forward, fall back”), but I didn’t know which time of the year is considered to be in “daylight saving.”

So I Googled “daylight saving time” and found this cool web page (hope it works in your browser). I browsed down through the “clouds” (nodes) Choose your region… –> North America –> United States and determined that I am currently in Standard Time, not Daylight Saving Time. Give it a try!

The underlying technology is called SpicyNodes. It is very reminiscent of mind-mapping software, e.g. FreeMind.