Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing deprecated time.clock() calls. #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions kazam/pulseaudio/pulseaudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ def get_audio_sources(self):
try:
logger.debug("get_audio_sources() called.")
pa_context_get_source_info_list(self.pa_ctx, self._pa_sourcelist_cb, None)
t = time.clock()
while time.clock() - t < 5:
t = time.perf_counter()
while time.perf_counter() - t < 5:
if self.pa_status == PA_FINISHED:
self.sources = self._sources
self._sources = []
Expand All @@ -270,8 +270,8 @@ def get_source_info_by_index(self, index):
try:
logger.debug("get_source_info_by_index() called. IDX: {0}".format(index))
pa_context_get_source_info_by_index(self.pa_ctx, index, self._pa_sourceinfo_cb, None)
t = time.clock()
while time.clock() - t < 5:
t = time.perf_counter()
while time.perf_counter() - t < 5:
if self.pa_status == PA_FINISHED:
time.sleep(0.1)
ret = self._return_result
Expand All @@ -285,8 +285,8 @@ def set_source_volume_by_index(self, index, cvolume):
try:
pa_context_set_source_volume_by_index(self.pa_ctx, index, cvolume,
self._pa_context_success_cb, None)
t = time.clock()
while time.clock() - t < 5:
t = time.perf_counter()
while time.perf_counter() - t < 5:
if self.pa_status == PA_FINISHED:
return 1
raise PAError(PA_GET_SOURCES_TIMEOUT, "Unable to get sources, operation timed out.")
Expand All @@ -297,8 +297,8 @@ def set_source_mute_by_index(self, index, mute):
try:
pa_context_set_source_mute_by_index(self.pa_ctx, index, mute,
self._pa_context_success_cb, None)
t = time.clock()
while time.clock() - t < 5:
t = time.perf_counter()
while time.perf_counter() - t < 5:
if self.pa_status == PA_FINISHED:
return 1
raise PAError(PA_GET_SOURCES_TIMEOUT, "Unable to get sources, operation timed out.")
Expand Down