HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/dateutils.cpython-310.pyc
o

�N�g	�@svdZddlZddlZddlmZzddlZdZWney#dZYnwdd�Z	ed�ed	�ddd	���Z
dd
�ZdS)z9
Convenience functions for dealing with datetime classes
�N)�jinja_filterTFcCs�|dur	tj��St|tj�r|Sz3t|t�r>ztr&t�tjj	�
|��WWSWn	ty0Ynw|��r:t
|�}nt|�}tj�|�WSty\trTtd|����td|�d���w)zv
    Casts any object into a datetime.datetime object

    date
      any datetime, time string representation...
    NzUnable to parse z. Consider installing timelib)�datetime�now�
isinstance�str�HAS_TIMELIB�timelibZ
strtodatetime�salt�utilsZstringutils�to_bytes�
ValueError�isdigit�int�float�
fromtimestamp�	Exception�RuntimeError)�date�r�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/dateutils.py�	date_casts,

��
�rZdate_format�strftime�%Y-%m-%dcCst|��|�S)a#
    Converts date into a time-based string

    date
      any datetime, time string representation...

    format
       :ref:`strftime<http://docs.python.org/2/library/datetime.html#datetime.datetime.strftime>` format

    >>> import datetime
    >>> src = datetime.datetime(2002, 12, 25, 12, 00, 00, 00)
    >>> strftime(src)
    '2002-12-25'
    >>> src = '2002/12/25'
    >>> strftime(src)
    '2002-12-25'
    >>> src = 1040814000
    >>> strftime(src)
    '2002-12-25'
    >>> src = '1040814000'
    >>> strftime(src)
    '2002-12-25'
    )rr)r�formatrrrr6scCs"|j|j|jddddS)z�
    Takes a timedelta and returns the total number of seconds
    represented by the object. Wrapper for the total_seconds()
    method which does not exist in versions of Python < 2.7.
    �ii@B)�microseconds�seconds�days)�tdrrr�
total_secondsSs"r)Nr)�__doc__rZsalt.utils.stringutilsr	Zsalt.utils.decorators.jinjarrr�ImportErrorrrrrrrr�<module>s�$