From: Stephen Seo Date: Thu, 16 Dec 2021 02:10:10 +0000 (+0900) Subject: Fix get current_song_pos in shared X-Git-Tag: 0.2.0~1 X-Git-Url: https://git.seodisparate.com/tbm-server-edit-set-haste.png?a=commitdiff_plain;h=7fb3525ec709993a7525f457809e58aa7ad2135f;p=mpd_info_screen Fix get current_song_pos in shared When polling for the shared data, the position of the song now accounts for when the position was polled (using an Instant object set to "now()" on poll, and returning the position with the Instant's elapsed time). --- diff --git a/src/mpd_handler.rs b/src/mpd_handler.rs index f97f10e..b2bac32 100644 --- a/src/mpd_handler.rs +++ b/src/mpd_handler.rs @@ -296,7 +296,8 @@ impl MPDHandler { title: read_lock.current_song_title.clone(), artist: read_lock.current_song_artist.clone(), length: read_lock.current_song_length, - pos: read_lock.current_song_position, + pos: read_lock.current_song_position + + read_lock.song_pos_get_time.elapsed().as_secs_f64(), error_text: read_lock.error_text.clone(), }); }