setForeground method
Implementation
void setForeground(bool value) {
if (value == _foreground) return;
_foreground = value;
if (!_started) return;
if (value) {
_visibleSinceMs = _clock();
} else {
_dwellTotalMs += _clock() - _visibleSinceMs;
}
}