Share via


CFileTimeSpan Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at 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

This class provides methods for managing relative periods of time often encountered when performing operations concerning when a file was created, last accessed or last modified. The methods of this class are frequently used in conjunction 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 milliseconds.

Remarks

The CFileTimeSpan object can be created using an existing CFileTimeSpan object, or expressed as a 64-bit value. 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 milliseconds.

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 is not 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 milliseconds.

See Also

FILETIME
CFileTime Class
Hierarchy Chart
ATL/MFC Shared Classes