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.

class CFileTimeSpan

Public Constructors

NameDescription
CFileTimeSpan::CFileTimeSpanThe constructor.

Public Methods

NameDescription
CFileTimeSpan::GetTimeSpanCall this method to retrieve the time span from the CFileTimeSpan object.
CFileTimeSpan::SetTimeSpanCall this method to set the time span of the CFileTimeSpan object.

Public Operators

NameDescription
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.

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.

See the example for CFileTime::Millisecond.

Header: atltime.h

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.

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

LONGLONG GetTimeSpan() const throw();

Return Value

Returns the time span in milliseconds.

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.

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.

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.

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.

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.

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.

The assignment operator.

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

Parameters

span
A CFileTimeSpan object.

Return Value

Returns the updated CFileTimeSpan object.

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.

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.

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.

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.

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.

FILETIME
CFileTime Class
Hierarchy Chart
ATL/MFC Shared Classes

Show: