CFileTimeSpan class

This class provides methods for managing relative date and time values associated with a file.

Syntax

class CFileTimeSpan

Members

Public constructors

Name Description
CFileTimeSpan::CFileTimeSpan The constructor.

Public methods

Name Description
CFileTimeSpan::GetTimeSpan Call this method to retrieve the time span from the CFileTimeSpan object.
CFileTimeSpan::SetTimeSpan Call this method to set the time span of the CFileTimeSpan object.

Public operators

Name Description
CFileTimeSpan::operator - Performs subtraction on a CFileTimeSpan object.
CFileTimeSpan::operator != Compares two CFileTimeSpan objects for inequality.
CFileTimeSpan::operator + Performs addition on a CFileTimeSpan object.
CFileTimeSpan::operator += Performs addition on a CFileTimeSpan object and assign the result to the current object.
CFileTimeSpan::operator < Compares two CFileTimeSpan objects to determine the lesser.
CFileTimeSpan::operator <= Compares two CFileTimeSpan objects to determine equality or the lesser.
CFileTimeSpan::operator = The assignment operator.
CFileTimeSpan::operator -= Performs subtraction on a CFileTimeSpan object and assign the result to the current object.
CFileTimeSpan::operator == Compares two CFileTimeSpan objects for equality.
CFileTimeSpan::operator > Compares two CFileTimeSpan objects to determine the larger.
CFileTimeSpan::operator >= Compares two CFileTimeSpan objects to determine equality or the larger.

Remarks

The CFileTimeSpan class provides methods to handle relative periods of time in the units the file system uses. These units are often used in file operations, such as when a file was created, last accessed, or last modified. The methods of this class are frequently used together with CFileTime class objects.

Example

See the example for CFileTime::Millisecond.

Requirements

Header: atltime.h

CFileTimeSpan::CFileTimeSpan

The constructor.

CFileTimeSpan() throw();
CFileTimeSpan(const CFileTimeSpan& span) throw();
CFileTimeSpan(LONGLONG nSpan) throw();

Parameters

span
An existing CFileTimeSpan object.

nSpan
A period of time in FILETIME units.

Remarks

The CFileTimeSpan object can be created using an existing CFileTimeSpan object, or expressed as a 64-bit value in 100-nanosecond FILETIME units. For more information, see CFileTime. The default constructor sets the time span to 0.

CFileTimeSpan::GetTimeSpan

Call this method to retrieve the time span from the CFileTimeSpan object.

LONGLONG GetTimeSpan() const throw();

Return value

Returns the time span in 100-nanosecond FILETIME units. For more information, see CFileTime.

CFileTimeSpan::operator -

Performs subtraction on a CFileTimeSpan object.

CFileTimeSpan operator-(CFileTimeSpan span) const throw();

Parameters

span
A CFileTimeSpan object.

Return value

Returns a CFileTimeSpan object representing the result of the difference between two time spans.

CFileTimeSpan::operator !=

Compares two CFileTimeSpan objects for inequality.

bool operator!=(CFileTimeSpan span) const throw();

Parameters

span
The CFileTimeSpan object to be compared.

Return value

Returns TRUE if the item being compared isn't equal to the CFileTimeSpan object; otherwise FALSE.

CFileTimeSpan::operator +

Performs addition on a CFileTimeSpan object.

CFileTimeSpan operator+(CFileTimeSpan span) const throw();

Parameters

span
A CFileTimeSpan object.

Return value

Returns a CFileTimeSpan object containing the sum of the two time spans.

CFileTimeSpan::operator +=

Performs addition on a CFileTimeSpan object and assigns the result to the current object.

CFileTimeSpan& operator+=(CFileTimeSpan span) throw();

Parameters

span
A CFileTimeSpan object.

Return value

Returns the updated CFileTimeSpan object containing the sum of the two time spans.

CFileTimeSpan::operator <

Compares two CFileTimeSpan objects to determine the lesser.

bool operator<(CFileTimeSpan span) const throw();

Parameters

span
The CFileTimeSpan object to be compared.

Return value

Returns TRUE if the first object is less (that is, represents a shorter time period) than the second, otherwise FALSE.

CFileTimeSpan::operator <=

Compares two CFileTimeSpan objects to determine equality or the lesser.

bool operator<=(CFileTimeSpan span) const throw();

Parameters

span
The CFileTimeSpan object to be compared.

Return value

Returns TRUE if the first object is less than (that is, represents a shorter time period) or equal to the second, otherwise FALSE.

CFileTimeSpan::operator =

The assignment operator.

CFileTimeSpan& operator=(const CFileTimeSpan& span) throw();

Parameters

span
A CFileTimeSpan object.

Return value

Returns the updated CFileTimeSpan object.

CFileTimeSpan::operator -=

Performs subtraction on a CFileTimeSpan object and assigns the result to the current object.

CFileTimeSpan& operator-=(CFileTimeSpan span) throw();

Parameters

span
A CFileTimeSpan object.

Return value

Returns the updated CFileTimeSpan object.

CFileTimeSpan::operator ==

Compares two CFileTimeSpan objects for equality.

bool operator==(CFileTimeSpan span) const throw();

Parameters

span
The CFileTimeSpan object to be compared.

Return value

Returns TRUE if the objects are equal, otherwise FALSE.

CFileTimeSpan::operator >

Compares two CFileTimeSpan objects to determine the larger.

bool operator>(CFileTimeSpan span) const throw();

Parameters

span
The CFileTimeSpan object to be compared.

Return value

Returns TRUE if the first object is greater than (that is, represents a longer time period) than the second, otherwise FALSE.

CFileTimeSpan::operator >=

Compares two CFileTimeSpan objects to determine equality or the larger.

bool operator>=(CFileTimeSpan span) const throw();

Parameters

span
The CFileTimeSpan object to be compared.

Return value

Returns TRUE if the first object is greater than (that is, represents a longer time period) or equal to the second, otherwise FALSE.

CFileTimeSpan::SetTimeSpan

Call this method to set the time span of the CFileTimeSpan object.

void SetTimeSpan(LONGLONG nSpan) throw();

Parameters

nSpan
The new value for the time span in 100-nanosecond FILETIME units. For more information, see CFileTime.

See also

FILETIME
CFileTime class
Hierarchy chart
ATL/MFC shared classes