MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.4/site-packages/mx/DateTime/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.4/site-packages/mx/DateTime/DateTime.pyo
m
fN5?c	@sdZdkTdklZeddddZedddZeddZedZedZe	ddZ
dZdZdfd	YZ
[
etietieeetid
ZetietieeetidZedZd
ZdddtitiedZdddedZdZdZeZ ei!Z"e"dZ#dZ$dZ%dZ&dZ'dZ(etidZ)etidZ*etidZ+eZ,eZ-eZ.eZ/eZ0eZ1eZ2e&Z3e(Z4e&Z5eZ6e0Z7e8Z9dZ:e:Z;edZ<dZ=dZ>dZ?dZ@d ZAd!ZBd"ZChd#d!<d"d$<d$d"<d%d<d&d<d'd <d(d<d)d<d!d#<d d'<dd%<dd&<dd(<dd)<ZDdZEdZFdZGd ZHd!ZId"ZJdZKd*ZLd+ZMd,ZNd-ZOd.ZPhdd/<dd0<ed<d1d<d-d2<d3d.<d4d"<d5d<d6d+<d7d*<d0d<d2d-<d8d <d.d3<d9d!<d,d:<d+d6<d*d7<dd1<d"d4<d!d9<d d8<d:d,<d/d<dd5<de<ZQed;d.d<ZRed=ddZSeTd>d?ZUeUZVd@fdAYZWeWZXdBZYtieeZeWdCZ[e[Z\e[Z]e^i_e^i_dDdDdEZ`dFZadGZbdHS(IsK Python part of the low-level DateTime[Delta] type implementation.

    Copyright (c) 1998-2001, Marc-Andre Lemburg; mailto:mal@lemburg.com
    Copyright (c) 2000-2001, eGenix.com Software GmbH; mailto:info@egenix.com
    See the documentation for further information on copyrights,
    or contact the author. All Rights Reserved.
(t*(s__version__iiicCs
t||S(N(tDateTimeFromAbsDateTimetabsdatetabstime(RR((t8/usr/lib/python2.4/site-packages/mx/DateTime/DateTime.pyt_DTscCs
t|S(N(tDateTimeDeltaFromSecondstseconds(R((Rt_DTDstmodinitcBs5tZdkZdkZdkZeaeaeaRS(N(t__name__t
__module__ttimetstringtmatht_timet_stringt_math(((RR	s
cCs|djo
|}n
||}||d}||}||d \}}
}}	}
}|||}|||
||	|
|S(slocaltime(ticks=None)

       Construct a DateTime instance using local time from ticks.  If
       ticks are not given, it defaults to the current time.  The
       result is similar to time.localtime(). Fractions of a second
       are rounded to the nearest micro-second.

    iN(ttickstNoneRtfloattroundtfloortftickst	localtimetYtMtDthtmtstDateTime(RRRRRtintRRRRRRRRR((RR)s

"cCs|djo
|}n
||}||d}||}
||d \}
}	}}}}|||
}||
|	||||S(sgmtime(ticks=None)

       Construct a DateTime instance using UTC time from ticks.  If
       ticks are not given, it defaults to the current time.  The
       result is similar to time.gmtime(). Fractions of a second are
       rounded to the nearest micro-second.

    iN(RRRRRRRtgmtimeRRRRRRR(RRRR!RR RRRRRRRRR((RR!@s

"c	Cs:|\	}}}}}}}}	}
|||||||S(smktime((year,month,day,hour,minute,second,dow,doy,dst))

       Same as the DateTime() constructor accept that the interface
       used is compatible to the similar time.mktime() API.

       Note that the tuple elements dow, doy and dst are not used in
       any way.
      
    N(
tyeartmonthtdaythourtminutetsecondtdowtdoytdstR(t.0RR"R#R$R%R&R'R(R)R*((RtmktimeWs!cCs
|idS(sctime(datetime)

       Returns a string representation of the given DateTime instance
       using the current locale's default settings.

    s%cN(tdatetimetstrftime(R-((Rtctimefsf0.0c	Cs5||d \}}}|||||||S(stoday(hour=0,minute=0,second=0.0)

       Returns a DateTime instance for today (in local time) at the
       given time (defaults to midnight).

    iN(	RRRRRRR%R&R'(	R%R&R'RRRRRR((Rttodayps	cCs|d|||S(sTimeDelta(hours=0.0,minutes=0.0,seconds=0.0)

       Returns a DateTimeDelta-object reflecting the given time
       delta. Seconds can be given as float to indicate fractions.

    iN(t
DateTimeDeltathourstminutesR(R2R3RR1((Rt	TimeDelta}s	cCst|iS(s gm2local(datetime)

        Convert a DateTime instance holding UTC time to a DateTime
        instance using local time.

    N(RR-tgmticks(R-((Rtgm2localscCst|iS(s local2gm(datetime)

        Convert a DateTime instance holding local time to a DateTime
        instance using UTC time.

    N(R!R-R(R-((Rtlocal2gmscCst||ddS(se DateTimeFromTJD(tjd[,myriad])

        Return a DateTime instance for the given Truncated Julian Day.
        myriad defaults to the TJD myriad current at package import
        time.

        Note that this version of Truncated Julian Day number does
        real truncation of important information. It's use is
        discouraged and unsupported.

    f10000.0f	1721425.0N(tDateTimeFromAbsDaysttjdt
tjd_myriad(R9R:((RtDateTimeFromTJDscCst|dS(s DateTimeFromJDN(jdn)

        Return a DateTime instance for the given Julian Day Number.

        References:
        -----------
        Gregorian 2000-01-01 12:00:00 corresponds to JDN 2451545.0.
        Gregorian 1858-11-17 00:00:00.00 corresponds to JDN 2400000.5; MJD 0.0.
        Julian -4712-01-01 12:00:00.00 corresponds to JDN 0.0.
        Gregorian -4713-11-24 12:00:00.00 corresponds to JDN 0.0.

    f	1721425.5N(R8tjdn(R<((RtDateTimeFromJDNs
cCst|dS(s DateTimeFromMJD(mjd)

        Return a DateTime instance for the given Modified Julian Day
        (MJD). The MJD is calculated the same way as the JDN except
        that 1858-11-17 00:00:00.00 is taken as origin of the scale.

    f678575.0N(R8tmjd(R>((RtDateTimeFromMJDsc
Os!dk}t|djo|d}t||ijodk}|i|Sqt|tjo|Sqt|t	jo
t
dqyt|}Wnt
j
ot
|}nXt|SnMt|djot|djo^t|d|ijoDt|d|ijo*dk}|i|dd|dSntt|Snt|djo|idd}
|idd}	|id	d}t}|id
|i}|id|i}|id|i}t||||
|	|Sn
t
d
dS(s DateTimeFrom(*args,**kws)

        Generic DateTime instance constructor. Can handle parsing
        strings, numbers and keywords.

    Niis(cannot convert DateTimeDelta to DateTimeit R%R&R'R$R#R"s$cannot convert arguments to DateTime(ttypestlentargstargttypet
StringTypetParsertDateTimeFromStringtDateTimeTypetDateTimeDeltaTypet	TypeErrorRtvalueR tDateTimeFromTickstapplyRtkwstgetR%R&R'tnowR0R$R#R"(
RCROR"R'RDRAR0R#R$R&R%RGRL((RtDateTimeFroms>	
	
G	!	c
Ostdk}	t|djo|d}t||	ijodk}|i|Sqpt|tjo|Sqpt|t	jo
t
dqpyt|}Wnt
j
ot
|}nXt|Snt|djott|Sn|t|djo_|idd}|idd}|idd}|id	d}t||||Sn
t
d
dS(s DateTimeDeltaFrom(*args,**kws)

        Generic DateTimeDelta instance constructor. Can handle parsing
        strings, numbers and keywords.

    Niis(cannot convert DateTime to DateTimeDeltaR2R3Rf0.0tdayss)cannot convert arguments to DateTimeDelta(RARBRCRDRERFRGtDateTimeDeltaFromStringRJRIRKRRLR RRNR1RORPR2R3RRS(
RCRORGR3RRSR2RLRDRA((RtDateTimeDeltaFroms2	
	
cOs<t|djottd|Sntt||SdS(s TimeDeltaFrom(*args,**kws)

        Generic TimeDelta instance constructor. Can handle parsing
        strings, numbers and keywords.

    iiN(i(RBRCRNR1RURO(RCRO((Rt
TimeDeltaFrom*scCst|||d S(s DateFromTicks(ticks)

        Constructs a DateTime instance pointing to the local time date
        at 00:00:00.00 (midnight) indicated by the given ticks value.
        The time part is ignored.

    iN(RNRRR(RRR((Rt
DateFromTicks;s
cCst|||d S(s TimestampFromTicks(ticks)

        Constructs a DateTime instance pointing to the local date and
        time indicated by the given ticks value.

    iN(RNRRR(RRR((RtTimestampFromTicksHs	cCst|d||dd!S(s TimeFromTicks(ticks)

        Constructs a DateTimeDelta instance pointing to the local time
        indicated by the given ticks value. The date part is ignored.

    iiiN(i(RNR1RR(RR1R((Rt
TimeFromTicksTs	cCs
|iS(sgmticks(datetime)

       [DEPRECIATED: use the .gmticks() method]
    
       Returns a ticks value based on the values stored in
       datetime under the assumption that they are given in UTC,
       rather than local time.

    N(R-R5(R-((RR5rs
cCs
|iS(s+tz_offset(datetime)

       [DEPRECIATED: use the .gmtoffset() method]
    
       Returns a DateTimeDelta instance representing the UTC
       offset for datetime assuming that the stored values refer
       to local time. If you subtract this value from datetime,
       you'll get UTC time.

    N(R-t	gmtoffset(R-t	oneSecond((Rt	tz_offsets
iiiiitSaturdaytSundaytThursdayt	WednesdaytFridaytTuesdaytMondayii	i
iitFebruarytMarchtJulytNovembertDecembertJunetJanuaryt	SeptembertAugusttApriltMaytOctoberiYiiif86400.0tRelativeDateTimecBs
tZdZdZdZdZeZdZdZ	dZ
dZdZeZ
eZeZeZddddddeeeeeeeddZedZeeeedZdZeedZdZdZd	ZeZd
Zei dZ!dZ"RS(
sRelativeDateTime(years=0,months=0,days=0,
                  hours=0,minutes=0,seconds=0,
                  year=0,month=0,day=0,
                  hour=None,minute=None,second=None,
                  weekday=None,weeks=None)

       Returns a RelativeDateTime instance for the specified relative
       time. The constructor handles keywords, so you'll only have to
       give those parameters which should be changed when you add the
       relative to an absolute DateTime instance.

       Adding RelativeDateTime instances is supported with the
       following rules: deltas will be added together, right side
       absolute values override left side ones.

       Adding RelativeDateTime instances to DateTime instances will
       return DateTime instances with the appropriate calculations
       applied, e.g. to get a DateTime instance for the first of next
       month, you'd call now() + RelativeDateTime(months=+1,day=1).

    icCs||_||_||d|_||_||_|	|_||_||_	||_
|
|_||_||_
|
ot|
dj|
|_ndS(Nii(tyearstselftmonthsRStweeksR"R#R$R2R3RR%R&R'tweekdayRB(RrRqRsRSR2R3RR"R#R$R%R&R'RuRt((Rt__init__s											cCs:||tot}|i|i|_|i|i|_|i|i|_|ip|i|_|i	p|i	|_	|i
p|i
|_
|ip|i|_|i|i|_|i
|i
|_
|i|i|_|ip|i|_|ip|i|_|ip|i|_|Sn
tddS(Nscan't add the two types(t
isinstancetotherRptrRrRqRsRSR"R#R$RuR2R3RR%R&R'RK(RrRxRwRy((Rt__add__s"	cCs|||o|idjo|i|i}
n|i|i}
|idjo|i|i}
n|i|i}
|i	djo
|i	}n
|i	}|djo|
d}
|d}n||i
}|idjo|i|i}	n|i|i}	|i
djo|i
|i}n|i
|i}|idjo|i|i}n|i|i}|
djp
|
djo*|
d}
|
|
d}
|
dd}
n|idjo+||
|
d||d|	||Sn|i\}}||
|
d||d|	||}|djo|||iSq
|djoW||i	d}||i}|djo|||ddSq|||dSq
||i|i	}||i}|djo|||ddSq
|||dSn
tddS(Niiiiscan't add the two types(RwRxRIRrR"RRqR#RsR$RSR%R2R&R3R'RRuRR1tday_of_weektindextdtfirsttdifft
days_in_monthtlastRK(RrRxRwRIRR1R|RR}R%R#R{R'R"RR$R&R~((Rt__radd__sZ
	



+)





cCs:t|tot}|i|i|_|i|i|_|i|i|_|ip|i|_|i	p|i	|_	|i
p|i
|_
|ip|i|_|i|i|_|i
|i
|_
|i|i|_|ip|i|_|ip|i|_|ip|i|_|Sn
tddS(Nscan't subtract the two types(RwRxRpRyRrRqRsRSR"R#R$RuR2R3RR%R&R'RK(RrRxRy((Rt__sub__ds"	cCs/||to||iSn
tddS(Nscan't subtract the two types(RwRxRIRrt__neg__RK(RrRxRwR((Rt__rsub__scCst}|i|_|i|_|i|_|i|_|i|_|i|_|i	|_	|i
|_
|i|_|i|_|i
|_
|i|_|i|_|S(N(RpRyRrRqRsRSR"R#R$RuR2R3RR%R&R'(RrRy((RRs	





cCs|idjo|idjo|idjo|idjo|idjo|idjox|idjoh|i	djoX|i
djoH|idjo8|idjo(|i
djo|idjodSndSdS(Nii(RrR"RRqR#RsR$RuRSR%R2R&R3R'R(Rr((Rt__nonzero__s
cCsyt|}t}||i|_||i|_||i|_||i	|_	||i
|_
||i|_|S(N(RRxtfactorRpRyRrRqRsRSR2R3R(RrRxRRy((Rt__mul__s	cCs|idt|S(Ni(RrRRRx(RrRx((Rt__div__scCs2g}|i}|idj	o|d|in*|io|d|in|d|idj	o|d|in*|io|d|in|d|idj	o|d|in*|i	o|d|i	n|d	|i
o.|d
t|i
dd |i
d
fn|d|idj	o|d|in*|i
o|d|i
n|d|idj	o|d|in*|io|d|in|d|idj	o|d|in*|io|d|in|d||dS(Ns%04i-s(%0+5i)-sYYYY-s%02i-s(%0+3i)-sMM-s%02is(%0+3i)tDDs %s:%iiiiR@s%02i:s(%0+3i):sHH:sMM:tSSt(tltappendRrR"RRqR#RsR$RSRutWeekdayR%R2R&R3R'Rtjoin(RrRRR((Rt__str__sH	






.






cCs#d|ii|it|fS(Ns<%s instance for '%s' at 0x%x>(Rrt	__class__R
Rtid(Rr((Rt__repr__s(#R
Rt__doc__RqRsRSRR"R#R$R2R3RR%R&R'RuRvRwRzRIRR1RRRRRRt__rmul__RRRRR(((RRps43J					/cOst|djoh|d}dk}t||ijodk}|i|Sqt|t	o|Sqt
dntt	||SdS(s RelativeDateTimeFrom(*args,**kws)

        Generic RelativeDateTime instance constructor. Can handle
        parsing strings and keywords.

    iiNs+cannot convert argument to RelativeDateTime(
RBRCRDRARERFRGtRelativeDateTimeFromStringRwRpRKRNRO(RCRORGRDRA((RtRelativeDateTimeFrom
s
		
c
Cs||}
|
idjo|Sn|id|id}|id|id}
||
}|
idjo||d\}}	n||d\}}	|}||d|d|	}||}|i|i}x||
idjo|
idjo#|d}||d\}}	n'|d}||d\}}	|}||d|d|	}||}|i|i}qW|djo|||}n|||}|d|d|	d|d|id	|id
|iS(s5 RelativeDateTimeDiff(date1,date2)

        Returns a RelativeDateTime instance representing the difference
        between date1 and date2 in relative terms.

        The following should hold: 
        
        date2 + RelativeDateDiff(date1,date2) == date1 

        for all dates date1 and date2.

        Note that due to the algorithm used by this function, not the
        whole range of DateTime instances is supported; there could
        also be a loss of precision.

        XXX There are still some problems left (thanks to Carel
        Fellinger for pointing these out):

        29 1 1901 ->  1 3 1901 = 1 month
        29 1 1901 ->  1 3 1900 = -10 month and -28 days, but
        29 1 1901 -> 28 2 1900 = -11 month and -1 day

        and even worse:

        >>> print RelativeDateDiff(Date(1900,3,1),Date(1901,2,1))
        YYYY-(-11)-DD HH:MM:SS

        with:

        >>> print Date(1901,1,29) + RelativeDateTime(months=-11)
        1900-03-01 00:00:00.00
        >>> print Date(1901,2,1) + RelativeDateTime(months=-11)
        1900-03-01 00:00:00.00

    iiiiRqRsRSR2R3RN(tdate1tdate2RRSRpR"R#tdate1monthstdate2monthst
diffmonthstdivmodRqRstdate3tdiff3tabsdaysR RR%R&R'(RRRR RRpRRRRsRRSRRRq((RtRelativeDateTimeDiff"sD'






			idcCsp|djo|Sn||}||}|djo|djo|Sn"|djo|dSn	|dSdS(s Sliding window approach to the Y2K problem: adds a suitable
        century to the given year and returns it as integer.

        The window used depends on the current year (at import time).
        If adding the current century to the given year gives a year
        within the range current_year-70...current_year+30 [both
        inclusive], then the current century is added. Otherwise the
        century (current + 1 or - 1) producing the least difference is
        chosen.

    iciiidN(R"tcurrent_centurytcurrent_yearR(R"RRR((Rtadd_centurys



cCsfd|d}|d|}|d|d}|d|dd|d|d	|d
|ddS(
Niiiii2ii
imiidii-}(R#taR"tyRR$(R"R#R$RRR((Rt
gregorian_jdnscCsVd|d}|d|}|d|d}|d|dd|d|d	d
S(Niiiii2ii
imiiS}(R#RR"RRR$(R"R#R$RRR((Rt
julian_jdnsN(cRt
mxDateTimet__version__R1R[t	oneMinutetoneHourtoneDaytoneWeekRtEpochRRR	RRRRRRR RRRR!R,R/R0R4R6R7tutctgmtR:tcurrent_myriadR;R=R?RRRURVRWRXRYtutctimet	utc2localt	local2utcRMtDatetTimet	TimestamptDateFromtTimeFromt
TimestampFromtGregorianDateTimet
GregorianDatetJulianDateTimet
JulianDateR5tutcticksR\RcRbR`R_RaR]R^RRjRdReRmRnRiRfRlRkRoRgRhtMonthtMaxDateTimetMinDateTimeRtMaxDateTimeDeltatMinDateTimeDeltaRptRelativeDateRRRtRelativeDateDifftAgeRQR"RRR(OR^R	RRReRaR,RXRRR7RRR5RpR/RRRR?RRYRRR\RfRR=R!R;RMRRR6RRkRRbRRRRRRRRRRlRcRRiRRRgR0RoRjR`RRRR[RRhRRRVR_RRnRRRdR4RmRRWRURR]((Rt?s
		**	
!
	
				4	)	

	J	Y#	

Anon7 - 2021