fixed wxTimeSpan::Format() to behave more reasonably

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-03-13 13:17:46 +00:00
parent e93bfe3c74
commit df05cdc578
5 changed files with 204 additions and 25 deletions

View File

@@ -145,7 +145,7 @@ values as parameter:
};
\end{verbatim}
Differnet parst of the world use different conventions for the week start.
Different parst of the world use different conventions for the week start.
In some countries, the week starts on Sunday, while in others - on Monday.
The ISO standard doesn't address this issue, so we support both conventions in
the functions whose result depends on it (\helpref{GetWeekOfYear}{wxdatetimegetweekofyear} and
@@ -174,8 +174,8 @@ No base class
\wxheading{See also}
\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp
wxTimeSpan,\rtfsp
wxDateSpan,\rtfsp
\helpref{wxTimeSpan}{wxtimespan},\rtfsp
\helpref{wxDateSpan}{wxdatespan},\rtfsp
\helpref{wxCalendarCtrl}{wxcalendarctrl}
\latexignore{\rtfignore{\wxheading{Function groups}}}

View File

@@ -11,5 +11,76 @@
\section{\class{wxTimeSpan}}\label{wxtimespan}
TODO
wxTimeSpan class represents a time interval.
\wxheading{Derived from}
No base class
\wxheading{Include files}
<wx/datetime.h>
\wxheading{See also}
\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp
\helpref{wxDateTime}{wxdatetime}
\latexignore{\rtfignore{\wxheading{Function groups}}}
\membersection{Static functions}
\membersection{Constructors}
\helpref{wxTimeSpan()}{wxtimespandef}
\helpref{wxTimeSpan(hours, min, sec, msec)}{wxtimespan}
\membersection{Accessors}
\membersection{Operations}
\membersection{Tests}
\membersection{Formatting time spans}
\helpref{Format}{wxtimespanformat}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Start of member function part %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\helponly{\insertatlevel{2}{
\wxheading{Members}
}}
\membersection{wxTimeSpan::Format}\label{wxtimespanformat}
\func{wxString}{Format}{\param{const wxChar * }{format = "\%H:\%M:\%S"}}
Returns the string containing the formatted representation of the time span.
The following format specifiers are allowed after \%:
\twocolwidtha{5cm}%
\begin{twocollist}\itemsep=0pt
\twocolitem{H}{number of {\bf H}ours}
\twocolitem{M}{number of {\bf M}inutes}
\twocolitem{S}{number of {\bf S}econds}
\twocolitem{l}{number of mi{\bf l}liseconds}
\twocolitem{D}{number of {\bf D}ays}
\twocolitem{E}{number of w{\bf E}eks}
\twocolitem{\%}{the percent character}
\end{twocollist}
Note that, for example, the number of hours in the description above is not
well defined: it can be either the total number of hours (for example, for a
time span of $50$ hours this would be $50$) or just the hour part of the time
span, which would be $2$ in this case as $50$ hours is equal to $2$ days and
$2$ hours.
wxTimeSpan resolves this ambiguity in the following way: if there had been,
indeed, the {\tt \%D} format specified preceding the {\tt \%H}, then it is
interpreted as $2$. Otherwise, it is $50$.
The same applies to all other format specifiers: if they follow a specifier of
larger unit, only the rest part is taken, otherwise the full value is used.