o
    b8                     @   sN   d Z ddlmZmZmZ ddlmZ ddgZ	G dd deZ
e
dddZdS )	z
Time zone utilities.
    )datetime	timedeltatzinfo)OptionalFixedOffsetTimeZoneUTCc                	   @   s   e Zd ZdZddedee ddfddZeded	e	d
e	dd fddZ
ededd fddZdee defddZdee defddZdee defddZdS )r   a*  
    Represents a fixed timezone offset (without daylight saving time).

    @ivar name: A L{str} giving the name of this timezone; the name just
        includes how much time this offset represents.

    @ivar offset: A L{TimeDelta} giving the amount of time this timezone is
        offset.
    Noffsetnamereturnc                 C   s   || _ || _dS )z
        Construct a L{FixedOffsetTimeZone} with a fixed offset.

        @param offset: a delta representing the offset from UTC.
        @param name: A name to be given for this timezone.
        N)r   r	   )selfr   r	    r   :/usr/lib/python3/dist-packages/twisted/python/_tzhelper.py__init__   s   
zFixedOffsetTimeZone.__init__signhoursminutesc                 C   sL   d|||f }|dkr| }| }n|dkrt d|| t||d|S )a
  
        Construct a L{FixedOffsetTimeZone} from an offset described by sign
        ('+' or '-'), hours, and minutes.

        @note: For protocol compatibility with AMP, this method never uses 'Z'

        @param sign: A string describing the positive or negative-ness of the
            offset.
        @param hours: The number of hours in the offset.
        @param minutes: The number of minutes in the offset

        @return: A time zone with the given offset, and a name describing the
            offset.
        z%s%02i:%02i-+zInvalid sign for timezone )r   r   )
ValueError	TimeDelta)clsr   r   r   r	   r   r   r   fromSignHoursMinutes'   s   z(FixedOffsetTimeZone.fromSignHoursMinutes	timeStampc                 C   s   t |t | }| |S )z
        Create a time zone with a fixed offset corresponding to a time stamp in
        the system's locally configured time zone.
        )DateTimefromtimestamputcfromtimestamp)r   r   r   r   r   r   fromLocalTimeStampA   s   z&FixedOffsetTimeZone.fromLocalTimeStampdtc                 C   s   | j S )z>
        Return the given timezone's offset from UTC.
        )r   r   r   r   r   r   	utcoffsetL   s   zFixedOffsetTimeZone.utcoffsetc                 C   s   t dS )zs
        Return a zero L{TimeDelta} for the daylight saving time
        offset, since there is never one.
        r   )r   r   r   r   r   dstR   s   zFixedOffsetTimeZone.dstc                 C   s&   | j dur| j S td| }|dS )z;
        Return a string describing this timezone.
        Nr   zUTC%z)r	   r   r   strftimer   r   r   r   tznameY   s   

zFixedOffsetTimeZone.tzname)N)__name__
__module____qualname____doc__r   r   strr   classmethodintr   floatr   r   r   r    r"   r   r   r   r   r      s$    


r   N)r&   r   r   r   r   r   TZInfotypingr   __all__r   r   r   r   r   r   r   <module>   s   R