)Ej dZddlZddlZddlmZmZddlZejdZgdZgdZ d dZ dZ d Z d Z d Zed kr,ddlZddlZejejjdSdS)zKfontTools.misc.timeTools.py -- tools for working with OpenType timestamps. N)datetimetimezone) iprrrrrrr)MonTueWedThuFriSatSun) NJanFebMarAprMayJunJulAugSepOctNovDecc |tj}t|jdt|jd|jddtjd|}|S)a 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 localtimeDAYNAMEStm_wday MONTHNAMEStm_montm_mdaystrftime)tss JC:\PYTHON\MyICR_Suite\python\Lib\site-packages\fontTools/misc/timeTools.pyasctimer&sa$ y N  18  mQ'''  A Hc pttjtd|tzS)Nr)r&rgmtimemax epoch_diffvalues r%timestampToStringr.;s) 4;s1ej&899:: ; ;;r'c|dd\}}tj|ddd}|t|t j}t|}| |ksJd|zdzt| tz S)Nz %d %H:%M:%S %Y)monthtzinfo"z" has inconsistent weekday) splitrstrptimereplacerindexrutcrweekdayint timestampr+)r-wkdaymnthr# wkday_idxs r%timestampFromStringr??s)//##KE4%)%677A ((..x| DDAu%%I 99;;) # # #S5[3O%O # # # q{{}}   **r'ctjd}|t|tz Stt jtz S)NSOURCE_DATE_EPOCH)osenvirongetr:r+r)source_date_epochs r% timestampNowrFHsJ ':;;$$%% 22 ty{{Z' ( ((r'c0t|tz SN)r:r+r,s r%timestampSinceEpochrIPs uz! " ""r'__main__rH)__doc__rBrrrcalendartimegmr+rrr&r.r?rFrI__name__sysdoctestexittestmodfailedr'r%rUs ''''''''X_; < < < < < "    :<<<+++)))### zJJJNNN CH_W_   %&&&&& r'