
    qi                     L    d Z ddlZdefdZdedefdZdedefdZdedefd	Zy)
zTime utilities for the Pipecat framework.

This module provides utility functions for time handling including
ISO8601 formatting, nanosecond conversions, and human-readable
time string formatting.
    Nreturnc                      t         j                   j                  t         j                  j                        j	                  d      S )zGet the current UTC time as an ISO8601 formatted string.

    Returns:
        The current UTC time in ISO8601 format with millisecond precision.
    milliseconds)timespec)datetimenowtimezoneutc	isoformat     D/opt/pipecat/venv/lib/python3.12/site-packages/pipecat/utils/time.pytime_now_iso8601r      s5       !2!2!6!67AA>AZZr   secondsc                     t        | dz        S )zConvert seconds to nanoseconds.

    Args:
        seconds: The number of seconds to convert.

    Returns:
        The equivalent number of nanoseconds as an integer.
     ʚ;)int)r   s    r   seconds_to_nanosecondsr      s     w&''r   nanosecondsc                     | dz  S )zConvert nanoseconds to seconds.

    Args:
        nanoseconds: The number of nanoseconds to convert.

    Returns:
        The equivalent number of seconds as a float.
    r   r   )r   s    r   nanoseconds_to_secondsr   &   s     &&r   c                     t        |       }t        |dz        }t        |dz  dz        }t        |dz        }t        |t        |      z
  dz        }| d|dd|dd|dS )zConvert nanoseconds to a human-readable time string.

    Args:
        nanoseconds: The number of nanoseconds to convert.

    Returns:
        A formatted time string in "H:MM:SS.microseconds" format.
    i  <   i@B :02.06)r   r   )r   total_secondshoursminutesr   microsecondss         r   nanoseconds_to_strr"   2   s}     +;7M%&E=4'B./G-"$%GM(::iGHLWAgb\72,aR/@AAr   )	__doc__r   strr   floatr   r   r   r"   r   r   r   <module>r&      sY    [# [	(E 	(c 	(	' 	' 	'BC BC Br   