o ö]Lb}ã@snddlmZddlZddlZddlZddlmZdZejGdd„de ƒƒZ dd „Z d d „Z d d „Z dd„ZdS)é)Úabsolute_importNé)Úerroriÿÿÿcs0eZdZdZ‡fdd„Zdd„Zdd„Z‡ZS)Ú timestampaì A Unix timestamp with optional nanoseconds precision, modulo 2**31 seconds. A 3-tuple containing: `truncated_seconds`: seconds since the Unix epoch, truncated to its lower 31 bits `subsecond_nanoseconds`: number of nanoseconds since `truncated_seconds`. When this is zero, the sub-second precision is considered unknown. `second_ambiguous`: whether this timestamp is still "reliable" (see `reliable_mtime_of`) if we drop its sub-second component. cs*|\}}}|t@||f}tt|ƒ ||¡S)N)Ú rangemaskÚsuperrÚ__new__)ÚclsÚvalueÚtruncated_secondsÚ subsec_nanosÚsecond_ambiguous©Ú __class__©úC/usr/lib/python3/dist-packages/mercurial/dirstateutils/timestamp.pyr$s ztimestamp.__new__cCó t d¡‚©Nz+timestamp should never be compared directly©rÚProgrammingError©ÚselfÚotherrrrÚ__eq__)óÿztimestamp.__eq__cCrrrrrrrÚ__gt__.rztimestamp.__gt__)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrÚ __classcell__rrrrrs  rc CsH| ¡\}}ztt |¡ƒWt |¡| |¡St |¡| |¡w)z~return a timestamp for "now" in the current vfs This will raise an exception if no temporary files could be created. )ÚmkstempÚmtime_ofÚosÚfstatÚcloseÚunlink)ÚvfsÚtmpfdÚtmpnamerrrÚ get_fs_now4s    ÿ r*cCs t td¡S)z4 Returns the `timestamp` at the Unix epoch. )rr)ÚtuplerrrrrrÚzeroAs r,cCsRz|j}Wnty|tj}d}Yn wtdƒ}||}||}t||dfƒS)zo Takes an `os.stat_result`-like object and returns a `timestamp` object for its modification time. rgeÍÍAF)Ú st_mtime_nsÚAttributeErrorÚstatÚST_MTIMEÚintr)Ú stat_resultÚnanosÚsecsr Úbillionrrrr"Hs   úr"cCsvt|ƒ}|d}|d}|d}|d}||kr)|r'|r'||kr't||dfƒSdS||kr6d|kr9dS|S|S)a4Same as `mtime_of`, but return `None` or a `Timestamp` with `second_ambiguous` set if the date might be ambiguous. A modification time is reliable if it is older than "present_time" (or sufficiently in the future). Otherwise a concurrent modification might happens with the same mtime. réTNi€Q)r"r)r2Ú present_mtimeÚ file_mtimeÚ file_secondÚfile_nsÚboundary_secondÚ boundary_nsrrrÚreliable_mtime_ofbs  ÿr=)Ú __future__rÚ functoolsr#r/ÚrrÚtotal_orderingr+rr*r,r"r=rrrrÚs  !