
    <`                         d Z ddlZddlZddlmZmZ ddlZ ej        d          Zg dZg dZ	ddZ
d Zd	 Zd
 Zd Zedk    r,ddlZddlZ ej         ej                    j                   dS dS )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           
          | t          j                    } t          | j                 dt          | j                 d| j        ddt          j        d|           }|S )ad  
	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
	N z>2z%H:%M:%S %Y)time	localtimeDAYNAMEStm_wday
MONTHNAMEStm_montm_mdaystrftime)tss     8lib/python3.11/site-packages/fontTools/misc/timeTools.pyasctimer&      s_    $ I
n!
19z!(+++QYYYY-q!!!# 	
    c           	      p    t          t          j        t          d| t          z                                 S )Nr   )r&   r   gmtimemax
epoch_diffvalues    r%   timestampToStringr.   +   s)    C5:#56677888r'   c                    | d d                                          \  }}t          j        | dd          d          }|                    t                              |          t          j                  }t                              |          }|	                                |k    sJ d| z   dz               t          |                                          t          z
  S )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    RaRy  uQRRy"344YYZ%%d++HLYAA^^E""			y   #+0L"L   AKKMMZ''r'   c                      t           j                            d          } | t          |           t          z
  S t          t          j                    t          z
            S )NSOURCE_DATE_EPOCH)osenvirongetr:   r+   r   )source_date_epochs    r%   timestampNowrF   6   sJ    Z^^$788!			*	,,DIKK*$%%%r'   c                 0    t          | t          z
            S N)r:   r+   r,   s    r%   timestampSinceEpochrI   =   s    EJ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    
			  ' ' ' ' ' ' ' '  X_;<<
<<</ / /

 
 
 
49 9 9( ( (& & &      z	/'/


"##### r'   