;ò
 æ~Dc           @   s  d  Z  d k Td d g d d g d d g d d	 g d
 d g d d g f Z d d g d d g d d g d d g d d g d d g f Z d d g d d g d d g d d g d
 d g d d g f Z d d g d  d! g d" d# g d d g d d g d d g f Z d$ d% d$ d& d$ d& d$ d$ d& d$ d& d$ f Z d$ d' d$ d& d$ d& d$ d$ d& d$ d& d$ f Z d( „  Z d) „  Z	 d* f  d+ „  ƒ  YZ
 e d, j o‰ e i i d- ƒ d k Te
 e d. d/ d0 ƒ d1 ƒ Z e i d2 ƒ GHe i d0 ƒ e i d3 ƒ GHe i d4 ƒ e i d5 ƒ GHd6 e i ƒ  GHn d7 S(8   sF   
   Copyright (C) 2001-2004 PimenTech SARL (http://www.pimentech.net)

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with this library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  
(   s   *s   years   yearss   months   monthss   days   dayss   hours   hourss   minutes   minutess   seconds   secondss   yrs   yss   mths   mhss   dyss   hrs   hss   mns   scs   ans   anss   moiss   jours   jourss   heures   heuress   secondes   secondess   mos   moss   jrs   jsi   i   i   i   c         C   s2   |  d o	 |  d p |  d o d Sn d Sd  S(   Ni   id   i  i   i    (   s   year(   s   year(    (    s   age.pys   is_bissextile   s    "c         C   s×   | d j p
 | d j  o
 d ‚ n t t |  i d ƒ i d ƒ ƒ \ } } } | | 7} | d j o | d } | d 7} nG | d j o d } | d 8} n& | d j  o | d } | d 8} n t	 | | | ƒ Sd  S(   Ni   iôÿÿÿs   Number out of ranges   %d/%m/%Ys   /i   i    (
   s   numbers   maps   ints   dates   strftimes   splits   ds   ms   ys   DateTime(   s   dates   numbers   ds   ms   y(    (    s   age.pys	   add_month%   s    
*


s   Agec           B   sJ   t  Z d  Z d d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s“   
	Calculate age from a DateTime with different precisions.
	precision = integer ; how much you want, zero is for all values : from year to second
	i    c         C   s@   | |  _  | o t ƒ  |  _ n
 | |  _ | |  _ f  |  _ d  S(   N(   s   datetimes   selfs   nows   DateTimes	   precisions   age(   s   selfs   datetimes	   precisions   now(    (    s   age.pys   __init__<   s    			c         C   sþ  d } } } } } } t |  i i	 ƒ  | |  i
 i	 ƒ  ƒ } | d j  o | d 7} | d 7} n |  i i ƒ  | |  i
 i ƒ  } | d j  o | d 7} | d 7} n |  i i ƒ  | |  i
 i ƒ  } | d j  o | d 7} | d 7} n |  i i ƒ  | |  i
 i ƒ  } | d j  o^ t |  i
 i ƒ  ƒ o | t |  i
 i ƒ  d 7} n | t |  i
 i ƒ  d 7} | d 7} n |  i i ƒ  | |  i
 i ƒ  } | d j  o | d 7} | d 7} n |  i i ƒ  | |  i
 i ƒ  } | | | | | | f |  _ d S(   s   privatei    i<   i   i   i   N(   s	   diff_years
   diff_months   diff_days	   diff_hours   diff_minutes   diff_seconds   ints   selfs   nows   seconds   datetimes   minutes   hours   days   is_bissextiles   years   day_month_biss   months	   day_months   age(   s   selfs	   diff_years	   diff_hours
   diff_months   diff_days   diff_seconds   diff_minute(    (    s   age.pys   _age_calculateE   s4     &
 
 
  
 c         C   s  g  } |  i  f  j o |  i ƒ  n |  i d j o d |  _ n |  i } xº |  i  D]¯ } | o | d j o |  i | j o | d 8} | i d ƒ qT | o | d j o |  i | j o | i d ƒ qT | d j o | i d ƒ qT | d 8} | i | ƒ qT W| Sd S(   s.   calculate precision and return the list of agei    i   i   N(   s   ages   selfs   _age_calculates	   precisions   time_cs   append(   s   selfs   time_cs   ages	   precision(    (    s   age.pys   getAgei   s&     	
 $
$
c         C   s_   |  i f  j o |  i ƒ  n d } x0 |  i D]% } | d j o | Sn | d 7} q. Wd Sd S(   s5   return the number of the first none null value of agei   i    N(   s   selfs   ages   _age_calculates   is   time_c(   s   selfs   is   time_c(    (    s   age.pys   getFirst   s     
 c         C   s   | |  _  d S(   s   change precision for getAge N(   s	   precisions   self(   s   selfs	   precision(    (    s   age.pys   changePrecisionŠ   s     c         C   sû   | d j o
 t } nF | d j o
 t } n/ | d j o
 t } n | d j o
 t } n |  i ƒ  } d } x~ t
 d ƒ D]p } | | d j o$ | d | | | | d	 f 7} q{ | | d j o$ | d | | | | d f 7} q{ q{ W| d
  Sd S(   s"   pseudo multi-lingual string formats   frs   ens   FRs   ENs    i   i   s   %d %s, i    iþÿÿÿN(   s   languages   fr_time_shorts   time_cs   en_time_shorts   fr_times   en_times   selfs   getAges   ages   strs   ranges   i(   s   selfs   languages   is   strs   time_cs   age(    (    s   age.pys   formatŽ   s$     



 $((	   s   __name__s
   __module__s   __doc__s   __init__s   _age_calculates   getAges   getFirsts   changePrecisions   format(    (    (    s   age.pys   Age6   s    		$			s   __main__s!   /usr/lib/zope/lib/python/DateTimeiÔ  i   i   i   s   frs   FRi    s   ens   %sN(   s   __doc__s   DateTimes   en_times   en_time_shorts   fr_times   fr_time_shorts	   day_months   day_month_biss   is_bissextiles	   add_months   Ages   __name__s   syss   paths   appends   ages   formats   changePrecisions   getFirst(
   s   en_times	   day_months   en_time_shorts	   add_months   Ages   fr_times   fr_time_shorts   day_month_biss   is_bissextiles   age(    (    s   age.pys   ?   s(   <<<<**		l
