Skip to content

Commit 4fca50a

Browse files
committed
Fix --for timing logic and bump version
Correct timer loop behavior by switching checks to compare elapsed time against cfg.forMs (elapsed >= cfg.forMs) instead of subtracting remaining time relative to cfg.ms. This prevents premature suppression of a valid second iteration and clarifies intent in comments. Update TESTROUTINE.md to reflect the expected two-run behavior and bump project version to 0.28.2 in Teefax.pro.
1 parent e10c364 commit 4fca50a

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎TESTROUTINE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ teefax 1s --loop --for 5s --mute --nomsg
201201
teefax 5s --loop --for 7s --mute --nomsg
202202
```
203203

204-
- [ ] Genau 1 Durchlauf (5s); zweiter Durchlauf startet nicht, da er die 7s-Grenze überschreiten würde
204+
- [ ] Genau 2 Durchläufe (5s + 5s = ~10s); zweiter Durchlauf startet bei ~5s, also noch innerhalb der 7s-Grenze
205205
- [ ] Exit-Code 0
206206

207207
```

‎Teefax.pro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CONFIG -= qt
66

77
LIBS += -lwinmm
88

9-
VERSION = 0.28.1
9+
VERSION = 0.28.2
1010
DEFINES += PRG_VERSION=\\\"$$VERSION\\\" \
1111

1212
QMAKE_TARGET_COMPANY = "Alsweider"

‎main.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,17 +1864,17 @@ static int runTimerLoop(TimerConfig& cfg) {
18641864
auto forWouldStop = [&]() -> bool {
18651865
if (!cfg.useFor || wallMode) return false;
18661866
auto elapsed = duration_cast<milliseconds>(steady_clock::now() - forStart).count();
1867-
return (cfg.forMs - elapsed) < cfg.ms;
1867+
return elapsed >= cfg.forMs;
18681868
};
18691869

18701870
do {
18711871
// --for (Option C):
1872-
// Countdown: naechste Iteration laeuft ueber --for-Grenze hinaus?
1872+
// Countdown: ist die --for-Zeit bereits abgelaufen? Dann keinen weiteren Durchlauf starten.
18731873
// Wanduhr: liegt der naechste Zielzeitpunkt noch innerhalb der --for-Zeit?
18741874
if (cfg.useFor) {
18751875
auto forElapsed = duration_cast<milliseconds>(steady_clock::now() - forStart).count();
18761876
if (!wallMode) {
1877-
if ((cfg.forMs - forElapsed) < cfg.ms) break;
1877+
if (forElapsed >= cfg.forMs) break;
18781878
} else {
18791879
if (forElapsed >= cfg.forMs) break;
18801880
// Naechsten Zielzeitpunkt vorausberechnen (non-destructive, kein Seiteneffekt)

0 commit comments

Comments
 (0)