[Python-checkins] python/dist/src/Doc/lib libdatetime.tex,1.37,1.38

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2003年1月23日 11:58:32 -0800


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv6005/python/Doc/lib
Modified Files:
	libdatetime.tex 
Log Message:
Reimplemented datetime.now() to be useful.
Index: libdatetime.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdatetime.tex,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** libdatetime.tex	22 Jan 2003 04:45:50 -0000	1.37
--- libdatetime.tex	23 Jan 2003 19:57:59 -0000	1.38
***************
*** 526,542 ****
 \end{methoddesc}
 
! \begin{methoddesc}{now}{}
! Return the current local datetime. This is like \method{today()},
! but, if possible, supplies more precision than can be gotten from
! going through a \function{time.time()} timestamp (for example,
! this may be possible on platforms that supply the C
 \cfunction{gettimeofday()} function).
 See also \method{today()}, \method{utcnow()}.
 \end{methoddesc}
 
 \begin{methoddesc}{utcnow}{}
! Return the current UTC datetime, with \member{tzinfo} \code{None}.
! This is like \method{now()}, but
! returns the current UTC date and time.
 See also \method{now()}.
 \end{methoddesc}
--- 526,548 ----
 \end{methoddesc}
 
! \begin{methoddesc}{now(tz=None)}{}
! Return the current local date and time. If optional argument
! \var{tz} is \code{None} or not specified, this is like
! \method{today()}, but, if possible, supplies more precision than can
! be gotten from going through a \function{time.time()} timestamp (for
! example, this may be possible on platforms supplying the C
 \cfunction{gettimeofday()} function).
+ 
+ Else \var{tz} must be an instance of a class \class{tzinfo} subclass,
+ and the current date and time are translated to \var{tz}'s time
+ zone. In this case the result is equivalent to
+ \code{\var{tz}.fromutc(datetime.utcnow().replace(tzinfo=\var{tz})}.
 See also \method{today()}, \method{utcnow()}.
 \end{methoddesc}
 
 \begin{methoddesc}{utcnow}{}
! Return the current UTC date and time, with \member{tzinfo} \code{None}.
! This is like \method{now()}, but returns the current UTC date and time,
! as a naive \class{datetime} object.
 See also \method{now()}.
 \end{methoddesc}

AltStyle によって変換されたページ (->オリジナル) /