#encoding = utf8
import time


class PlayClock:
    def __init__(self):
        self._start = time.time()
        self._current_time = 0
        self._display_time = self._start
        self._audio_diff_threshold = 0.01

    @property
    def start_time(self):
        return self._start

    @property
    def current_time(self):
        return self._current_time

    @current_time.setter
    def current_time(self, v):
        self._current_time = v

    @property
    def audio_diff_threshold(self):
        return self._audio_diff_threshold

    @property
    def display_time(self):
        return self._display_time

    def update_display_time(self):
        self._display_time = time.time()

    def clock_time(self):
        elapsed = time.time() - self._display_time
        return self.current_time + elapsed
