Skip to content

forms: Show session durations of a minute and longer - #15

Merged
zackees merged 2 commits into
obs-rust:masterfrom
rdoupe:fix/session-duration
Oct 17, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
rdoupe:fix/session-duration

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

The Session Duration column of the session table in Tools > WebSocket Server Settings counts 00:00:00 to 00:00:59 and then stays empty for the rest of the session, while the client is still connected and its message counts keep going up (upstream obsproject/obs-websocket#1208, reported by bryce-seifert; gitagogaming saw it too). SettingsDialog::FillSessionTable() (src/forms/SettingsDialog.cpp line 252) formatted the duration with QTime(0, 0, sessionDuration).toString("hh:mm:ss"). QTime(h, m, s) only takes s from 0 to 59, so from one minute on the QTime is invalid and toString() returns an empty string. DanielLester83 found this Qt limit in obsproject/obs-websocket#1179 (closed); that patch did not build (currentSecsSinceEpoch() returns a number, which has no addSecs()) and computed minutes as / 360, so this is a new fix.

Two commits:

  • forms: Move the session duration text into a helper: FormatSessionDuration() in the new header src/forms/SessionDuration.h, unchanged behaviour (still QTime(0, 0, seconds)), so it can be tested on its own.
  • forms: Show session durations of a minute and longer: the helper builds hh:mm:ss from the seconds count. The hours count on past 24 (QTime(0, 0).addSecs() would wrap to 00 after a day), and a negative count (the clock set back below the connect time) shows 00:00:00.

Tested in obs-rust/obs-studio with test_ws_session_duration, which builds the header with Qt Core only: 4 of 5 cases fail at the helper-only commit (one minute and more, hours, more than a day, clock set back) and 5 of 5 pass with the fix, in both libobs lanes. Also in a full OBS build (frontend + obs-websocket) in both lanes, and end to end: with one client connected, the release v0.1.0-beta.20261014 shows 00:00:32 at 30 s and an empty cell at 70 s; builds with this branch show 00:00:31 and 00:01:12 (C libobs lane) and 00:00:32 and 00:01:12 (Rust libobs lane).

Refs obs-rust/obs-studio#1116. The obs-rust/obs-studio PR that moves the submodule to this branch carries the regression test and closes the issue.

🤖 Generated with Claude Code

rdoupe and others added 2 commits October 16, 2026 15:39
The Session Duration column of the settings dialog's session table is
formatted by FormatSessionDuration() (forms/SessionDuration.h), so it
can be tested on its own. No change in behaviour: it still uses
QTime(0, 0, seconds).

Refs obs-rust/obs-studio#1116.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Session Duration column of the session table in Tools > WebSocket
Server Settings counted 00:00:00 to 00:00:59 and then stayed empty for
the rest of the session. QTime(0, 0, s) is only valid for s from 0 to
59, and an invalid QTime turns into an empty string.
FormatSessionDuration() now builds hh:mm:ss from the seconds count
itself; the hours count on past 24 instead of wrapping (QTime::addSecs()
would wrap), and a negative count (clock set back) shows 00:00:00.

Reported upstream in obsproject/obs-websocket#1208 by bryce-seifert.
DanielLester83 found the QTime range limit in
obsproject/obs-websocket#1179.

Refs obs-rust/obs-studio#1116.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants