
 Xo
              	   @   s   d  d l  m Z d  d l Z d  d l Z d  d l m Z d  d l m Z m Z d  d l	 m
 Z
 m Z d e d	 d
  f d! e d d  f d$ e d d  f d& e d d  f d' e d d  f d e d d  f f Z d d d d  Z d d d  Z d S)(    )unicode_literalsN)avoid_wrapping)is_awareutc)ugettextungettext_lazy<      im  z%d yearz%d years   z%d monthz	%d months   z%d weekz%d weeksz%d dayz%d daysz%d hourz%d hoursz	%d minutez
%d minutesFc             C   s  t  |  t j  s3 t j |  j |  j |  j  }  n  | rm t  | t j  rm t j | j | j | j  } n  | s t j j t |   r t n d  } n  | r |  | n | |  } | t j t	 j
 |  j | j   8} | j d d d | j } | d k rt t d   Sx: t t  D], \ } \ } } | | } | d k rPqqWt | |  }	 | d t t  k  rt | d \ }
 } | | | |
 } | d k r|	 t d  t | |  7}	 qn  |	 S)aW  
    Takes two datetime objects and returns the time between d and now
    as a nicely formatted string, e.g. "10 minutes".  If d occurs after now,
    then "0 minutes" is returned.

    Units used are years, months, weeks, days, hours, and minutes.
    Seconds and microseconds are ignored.  Up to two adjacent units will be
    displayed.  For example, "2 weeks, 3 days" and "1 year, 3 months" are
    possible outputs, but "2 weeks, 3 hours" and "1 year, 5 days" are not.

    Adapted from
    http://web.archive.org/web/20060617175230/http://blog.natbat.co.uk/archive/2003/Jun/14/time_since
    Nr	   r   r   z	0 minutes   z, )
isinstancedatetimeyearmonthdaynowr   r   	timedeltacalendarleapdaysdayssecondsr   r   	enumerateTIMESINCE_CHUNKSlen)dr   reverseddeltaZsinceir   namecountresultZseconds2Zname2Zcount2 r"   D/home/ubuntu/projects/ifolica/build/django/django/utils/timesince.py	timesince   s,    !!'%
$r$   c             C   s   t  |  | d d S)z[
    Like timesince, but returns a string measuring the time until
    the given time.
    r   T)r$   )r   r   r"   r"   r#   	timeuntilC   s    r%   i  iQ i3i  iQ i ' i  iQ i:	 i  iQ i  )
__future__r   r   r   Zdjango.utils.htmlr   Zdjango.utils.timezoner   r   Zdjango.utils.translationr   r   r   r$   r%   r"   r"   r"   r#   <module>   s   /