o
    üÞh=  ã                   @   s  d Z ddlZddlmZ ddlmZ dedefdd„Zd	edefd
d„Z	dedefdd„Z
dedefdd„Zdedefdd„Zdefdd„Zdedefdd„Zdedefdd„Zdedefdd„Zdedefdd„Zdedefd d!„Z	d%ded"eej dejfd#d$„ZdS )&z#Contains the Timestamp helper APIs.é    N)ÚOptional)Ú	TimestampÚvalueÚreturnc                 C   ó   t ƒ }| | ¡ |S )a<  Parse a RFC 3339 date string format to Timestamp.

  Args:
    value: A date string. Any fractional digits (or none) and any offset are
      accepted as long as they fit into nano-seconds precision. Example of
      accepted format: '1972-01-01T10:00:20.021-05:00'

  Raises:
    ValueError: On parsing problems.
  )r   ÚFromJsonString)r   Ú	timestamp© r	   úY/var/www/html/premium_crap/venv/lib/python3.10/site-packages/google/protobuf/timestamp.pyÚfrom_json_string   s   
r   Úmicrosc                 C   r   )z/Converts microseconds since epoch to Timestamp.)r   ÚFromMicroseconds)r   r   r	   r	   r
   Úfrom_microseconds    ó   
r   Úmillisc                 C   r   )z/Converts milliseconds since epoch to Timestamp.)r   ÚFromMilliseconds)r   r   r	   r	   r
   Úfrom_milliseconds'   r   r   Únanosc                 C   r   )z.Converts nanoseconds since epoch to Timestamp.)r   ÚFromNanoseconds)r   r   r	   r	   r
   Úfrom_nanoseconds.   r   r   Úsecondsc                 C   r   )z*Converts seconds since epoch to Timestamp.)r   ÚFromSeconds)r   r   r	   r	   r
   Úfrom_seconds5   r   r   c                  C   s"   t ƒ } |  tjjtjjd�¡ | S )z&Converts the current UTC to Timestamp.)Útz)r   ÚFromDatetimeÚdatetimeÚnowÚtimezoneÚutc)r   r	   r	   r
   Úfrom_current_time<   s   r   Útsc                 C   ó   |   ¡ S )a  Converts Timestamp to RFC 3339 date string format.

  Returns:
    A string converted from timestamp. The string is always Z-normalized
    and uses 3, 6 or 9 fractional digits as required to represent the
    exact time. Example of the return format: '1972-01-01T10:00:20.021Z'
  )ÚToJsonString©r    r	   r	   r
   Úto_json_stringC   s   r$   c                 C   r!   )z/Converts Timestamp to microseconds since epoch.)ÚToMicrosecondsr#   r	   r	   r
   Úto_microsecondsN   ó   r&   c                 C   r!   )z/Converts Timestamp to milliseconds since epoch.)ÚToMillisecondsr#   r	   r	   r
   Úto_millisecondsS   r'   r)   c                 C   r!   )z.Converts Timestamp to nanoseconds since epoch.)ÚToNanosecondsr#   r	   r	   r
   Úto_nanosecondsX   r'   r+   c                 C   r!   )z*Converts Timestamp to seconds since epoch.)Ú	ToSecondsr#   r	   r	   r
   Ú
to_seconds]   r'   r-   r   c                 C   s   | j |d�S )a7  Converts Timestamp to a datetime.

  Args:
    tz: A datetime.tzinfo subclass; defaults to None.

  Returns:
    If tzinfo is None, returns a timezone-naive UTC datetime (with no timezone
    information, i.e. not aware that it's UTC).

    Otherwise, returns a timezone-aware datetime in the input timezone.
  )Útzinfo)Ú
ToDatetime)r    r   r	   r	   r
   Úto_datetimeb   s   r0   )N)Ú__doc__r   Útypingr   Úgoogle.protobuf.timestamp_pb2r   Ústrr   Úfloatr   r   r   r   r   r$   Úintr&   r)   r+   r-   r.   r0   r	   r	   r	   r
   Ú<module>   s.   ÿÿÿþ