HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/mercurial/dirstateutils/__pycache__/timestamp.cpython-310.pyc
o

�]Lb}�@snddlmZddlZddlZddlZddlmZdZejGdd�de	��Z
dd	�Zd
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�<module>s!