Microsoft Foundation Classes (mfc.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
class CTimeSpan
◄Up► ◄Contents► ◄Index► ◄Back►
──Microsoft Foundation Classes──────────────────────────────────────────────
Description
A CTimeSpan object represents a relative time span. The CTimeSpan class
incorporates the ANSI time_t data type and its associated run-time
functions. These functions convert seconds to various combinations of
days, hours, minutes, and seconds.
A CTimeSpan object keeps time in seconds. Because the CTimeSpan object
is stored as a signed number in 4 bytes, the maximum allowed span is
about +- 68 years.
A companion class, ◄CTime►, represents an absolute time. A CTimeSpan is
the difference between two CTimes.
#include <afx.h>
See Also
Run-time functions: asctime, _ftime, gmtime, localtime, strftime, time
Derivation
The CTime and CTimeSpan classes are not designed for derivation. Because
there are no virtual functions, the size of both CTime and CTimeSpan
objects is exactly 4 bytes. Most member functions are inline.
Public Members
Construction/Destruction
◄CTimeSpan► Constructs CTimeSpan objects in various ways.
Extraction
◄GetDays► Returns the number of complete days in this
CTimeSpan.
◄GetHours► Returns the number of hours in the current day (-23
through 23).
◄GetTotalHours► Returns the total number of complete hours in this
CTimeSpan.
◄GetMinutes► Returns the number of minutes in the current hour
(-59 through 59).
◄GetTotalMinutes► Returns the total number of complete minutes in this
CTimeSpan.
◄GetSeconds► Returns the number of seconds in the current minute
(-59 through 59).
◄GetTotalSeconds► Returns the total number of complete seconds in this
CTimeSpan.
Conversion
◄Format► Converts a CTimeSpan into a formatted string.
Operators
◄operator =► Assigns new time-span values.
◄operators +, -► Add and subtract CTimeSpan objects.
◄operators +=, -=► Add and subtract a CTimeSpan object to and
from this CTimeSpan.
◄operators ==, <, etc.► Compare two relative time values.
Archive/Dump
◄operator <<► Outputs a CTimeSpan object to CArchive or CDumpContext.
◄operator >>► Inputs a CTimeSpan object from CArchive.
-♦-