
    h                         S r SSKrSSKrSSKJrJr  SSKr\R                  " S5      r/ SQr/ SQr	SS jr
S rS	 rS
 rS r\S:X  a4  SSKrSSKr\R$                  " \R&                  " 5       R(                  5        gg)zKfontTools.misc.timeTools.py -- tools for working with OpenType timestamps.
    N)datetimetimezone)	ip     r   r   r   r   r   r   r   )MonTueWedThuFriSatSun)NJanFebMarAprMayJunJulAugSepOctNovDecc           
          U c  [         R                  " 5       n [        U R                     < S[        U R
                     < SU R                  <S S[         R                  " SU 5      < 3nU$ )aX  
Convert a tuple or struct_time representing a time as returned by gmtime()
or localtime() to a 24-character string of the following form:

>>> asctime(time.gmtime(0))
'Thu Jan  1 00:00:00 1970'

If t is not provided, the current time as returned by localtime() is used.
Locale information is not used by asctime().

This is meant to normalise the output of the built-in time.asctime() across
different platforms and Python versions.
In Python 3.x, the day of the month is right-justified, whereas on Windows
Python 2.7 it is padded with zeros.

See https://github.com/fonttools/fonttools/issues/455
 z>2z%H:%M:%S %Y)time	localtimeDAYNAMEStm_wday
MONTHNAMEStm_montm_mdaystrftime)tss     J/var/www/html/env/lib/python3.13/site-packages/fontTools/misc/timeTools.pyasctimer&      sP    $ 	yNN188			mQ'		A H    c           	      b    [        [        R                  " [        SU [        -   5      5      5      $ )Nr   )r&   r   gmtimemax
epoch_diffvalues    r%   timestampToStringr.   ;   s"    4;;s1ej&89:;;r'   c                 n   U S S R                  5       u  p[        R                  " U SS  S5      nUR                  [        R                  U5      [        R                  S9n[        R                  U5      nUR                  5       U:X  d   SU -   S-   5       e[        UR                  5       5      [        -
  $ )N   z %d %H:%M:%S %Y)monthtzinfo"z" has inconsistent weekday)splitr   strptimereplacer   indexr   utcr   weekdayint	timestampr+   )r-   wkdaymnthr#   	wkday_idxs        r%   timestampFromStringr?   ?   s    )//#KE%)%67A			
((.x||	DAu%I99;)#OS5[3O%OO#q{{}
**r'   c                      [         R                  R                  S5      n U b  [        U 5      [        -
  $ [        [
        R
                  " 5       [        -
  5      $ )NSOURCE_DATE_EPOCH)osenvirongetr:   r+   r   )source_date_epochs    r%   timestampNowrF   H   sC    

':;$$%
22tyy{Z'((r'   c                 &    [        U [        -
  5      $ N)r:   r+   r,   s    r%   timestampSinceEpochrI   P   s    uz!""r'   __main__rH   )__doc__rB   r   r   r   calendartimegmr+   r   r   r&   r.   r?   rF   rI   __name__sysdoctestexittestmodfailed r'   r%   <module>rU      s|    
  '  __;<
<
":<+)# zHHW__%%&	 r'   