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).
This commit is contained in:
Stephen Seo 2021-12-16 11:10:10 +09:00
parent 4e4a073cb1
commit 7fb3525ec7

View file

@ -296,7 +296,8 @@ impl MPDHandler {
title: read_lock.current_song_title.clone(), title: read_lock.current_song_title.clone(),
artist: read_lock.current_song_artist.clone(), artist: read_lock.current_song_artist.clone(),
length: read_lock.current_song_length, 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(), error_text: read_lock.error_text.clone(),
}); });
} }