§
    E«j–  ã                   óò   — d Z ddlmZ ddlmZ dedefd„Zdedefd„Zdedefd	„Z	d
edefd„Z
dedefd„Zdedefd„Zdedefd„Zdedefd„Zdedefd„Zdedefd„Z e
d¦  «        Z G d„ d¦  «        ZdS )zA timer for use in lichess-bot.é    ©Ú	timedelta)Úperf_counterÚtime_in_msecÚreturnc                 ó"   — t          | ¬¦  «        S )z,Create a timedelta duration in milliseconds.)Úmillisecondsr   )r   s    ú$/app/lichess-bot-master/lib/timer.pyÚmsecr      s   € å ,Ð/Ñ/Ô/Ð/ó    Údurationc                 ó&   — | t          d¦  «        z  S )zMReturn a bare number representing the length of the duration in milliseconds.é   )r   ©r   s    r
   Úto_msecr      s   € à•d˜1‘g”gÑÐr   c                 óT   — t          t          t          | ¦  «        ¦  «        ¦  «        S )zEReturn a string with the duration value in whole number milliseconds.)ÚstrÚroundr   r   s    r
   Úmsec_strr      s    € å�u•W˜XÑ&Ô&Ñ'Ô'Ñ(Ô(Ð(r   Útime_in_secc                 ó"   — t          | ¬¦  «        S )z'Create a timedelta duration in seconds.)Úsecondsr   )r   s    r
   r   r      s   € å˜[Ð)Ñ)Ô)Ð)r   c                 ó*   — |                       ¦   «         S )zHReturn a bare number representing the length of the duration in seconds.)Útotal_secondsr   s    r
   Ú
to_secondsr      s   € à×!Ò!Ñ#Ô#Ð#r   c                 óT   — t          t          t          | ¦  «        ¦  «        ¦  «        S )z@Return a string with the duration value in whole number seconds.)r   r   r   r   s    r
   Úsec_strr       s    € å�u•Z Ñ)Ô)Ñ*Ô*Ñ+Ô+Ð+r   Útime_in_minutesc                 ó"   — t          | ¬¦  «        S )z'Create a timedelta duration in minutes.)Úminutesr   )r   s    r
   r    r    %   s   € å˜_Ð-Ñ-Ô-Ð-r   Útime_in_hoursc                 ó"   — t          | ¬¦  «        S )z%Create a timedelta duration in hours.)Úhoursr   )r!   s    r
   r#   r#   *   s   € å˜=Ð)Ñ)Ô)Ð)r   Útime_in_daysc                 ó"   — t          | ¬¦  «        S )z$Create a timedelta duration in days.©Údaysr   )r$   s    r
   r'   r'   /   s   € å˜,Ð'Ñ'Ô'Ð'r   Útime_in_yearsc                 ó&   — t          d¦  «        | z  S )z<Create a timedelta duration in median years--i.e., 365 days.im  r&   )r(   s    r
   Úyearsr*   4   s   € å�‰9Œ9�}Ñ$Ð$r   c                   óR   — e Zd ZdZefdeddfd„Zdefd„Zd
d„Z	defd„Z
defd	„ZdS )ÚTimeraM  
    A timer for use in lichess-bot. An instance of timer can be used both as a countdown timer and a stopwatch.

    If the duration argument in the __init__() method is greater than zero, then
    the method is_expired() indicates when the initial duration has passed. The
    method time_until_expiration() gives the amount of time left until the timer
    expires.

    Regardless of the initial duration (even if it's zero), a timer can be used
    as a stopwatch by calling time_since_reset() to get the amount of time since
    the timer was created or since it was last reset.
    r   r   Nc                 ó:   — || _         t          ¦   «         | _        dS )zë
        Start the timer.

        :param duration: The duration of time before Timer.is_expired() returns True.
        :param backdated_timestamp: When the timer should have started. Used to keep the timers between sessions.
        N)r   r   Ústarting_time)Úselfr   s     r
   Ú__init__zTimer.__init__J   s   € ð !ˆŒÝ)™^œ^ˆÔÐÐr   c                 ó<   — |                       ¦   «         | j        k    S )zCheck if a timer is expired.)Útime_since_resetr   ©r/   s    r
   Ú
is_expiredzTimer.is_expiredT   s   € à×$Ò$Ñ&Ô&¨$¬-Ò7Ð7r   c                 ó,   — t          ¦   «         | _        dS )zReset the timer.N)r   r.   r3   s    r
   ÚresetzTimer.resetX   s   € å)™^œ^ˆÔÐÐr   c                 óH   — t          t          ¦   «         | j        z
  ¦  «        S )zHow much time has passed.)r   r   r.   r3   s    r
   r2   zTimer.time_since_reset\   s   € å•|‘~”~¨Ô(:Ñ:Ñ;Ô;Ð;r   c                 óp   — t          t          d¦  «        | j        |                      ¦   «         z
  ¦  «        S )z'How much time is left until it expires.r   )Úmaxr   r   r2   r3   s    r
   Útime_until_expirationzTimer.time_until_expiration`   s+   € å•7˜1‘:”:˜tœ}¨t×/DÒ/DÑ/FÔ/FÑFÑGÔGÐGr   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úzero_secondsr   r0   Úboolr4   r6   r2   r:   © r   r
   r,   r,   <   s¶   € € € € € ðð ð .:ð ,ð , ð ,¸dð ,ð ,ð ,ð ,ð8˜Dð 8ð 8ð 8ð 8ð,ð ,ð ,ð ,ð< )ð <ð <ð <ð <ðH yð Hð Hð Hð Hð Hð Hr   r,   N)r>   Údatetimer   Útimer   Úfloatr   r   r   r   r   r   r   r    r#   r'   r*   r?   r,   rA   r   r
   ú<module>rE      sÎ  ðØ %Ð %à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ð0�uð 0 ð 0ð 0ð 0ð 0ð
�ið  Eð ð ð ð ð
)�yð ) Sð )ð )ð )ð )ð
*˜ð * 9ð *ð *ð *ð *ð
$˜ð $ uð $ð $ð $ð $ð
,�ið , Cð ,ð ,ð ,ð ,ð
.˜Uð . yð .ð .ð .ð .ð
*˜ð * 9ð *ð *ð *ð *ð
(�uð ( ð (ð (ð (ð (ð
%˜ð % 9ð %ð %ð %ð %ð
 ˆw�q‰zŒz€ð&Hð &Hð &Hð &Hð &Hñ &Hô &Hð &Hð &Hð &Hr   