다음을 통해 공유


CFileTime Class

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

class CFileTime : 
   public FILETIME

Members

Public Constructors

Name

Description

CFileTime::CFileTime

The constructor.

Public Methods

Name

Description

CFileTime::GetCurrentTime

Call this static function to retrieve a CFileTime object that represents the current system date and time.

CFileTime::GetTime

Call this method to retrieve the time from the CFileTime object.

CFileTime::LocalToUTC

Call this method to convert a local file time to a file time based on the Coordinated Universal Time (UTC).

CFileTime::SetTime

Call this method to set the date and time stored by the CFileTime object.

CFileTime::UTCToLocal

Call this method to convert time based on the Coordinated Universal Time (UTC) to local file time.

Public Operators

Name

Description

CFileTime::operator -

This operator is used to perform subtraction on a CFileTime or CFileTimeSpan object.

CFileTime::operator !=

This operator compares two CFileTime objects for inequality.

CFileTime::operator +

This operator is used to perform addition on a CFileTimeSpan object.

CFileTime::operator +=

This operator is used to perform addition on a CFileTimeSpan object and assign the result to the current object.

CFileTime::operator <

This operator compares two CFileTime objects to determine the lesser.

CFileTime::operator <=

This operator compares two CFileTime objects to determine equality or the lesser.

CFileTime::operator =

The assignment operator.

CFileTime::operator -=

This operator is used to perform subtraction on a CFileTimeSpan object and assign the result to the current object.

CFileTime::operator ==

This operator compares two CFileTime objects for equality.

CFileTime::operator >

This operator compares two CFileTime objects to determine the larger.

CFileTime::operator >=

This operator compares two CFileTime objects to determine equality or the larger.

Public Constants

Name

Description

CFileTime::Day

A static data member storing the number of 100-nanosecond intervals that make up one day.

CFileTime::Hour

A static data member storing the number of 100-nanosecond intervals that make up one hour.

CFileTime::Millisecond

A static data member storing the number of 100-nanosecond intervals that make up one millisecond.

CFileTime::Minute

A static data member storing the number of 100-nanosecond intervals that make up one minute.

CFileTime::Second

A static data member storing the number of 100-nanosecond intervals that make up one second.

CFileTime::Week

A static data member storing the number of 100-nanosecond intervals that make up one week.

Remarks

This class provides methods for managing the date and time values associated with the creation, access and modification of files. The methods and data of this class are frequently used in conjunction with CFileTimeSpan objects, which deal with relative time values.

The date and time value is stored as a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601. This is the Coordinated Universal Time (UTC) format.

The following static const member variables are provided to simplify calculations:

Member variable

Number of 100-nanosecond intervals

Millisecond

10,000

Second

Millisecond * 1,000

Minute

Second * 60

Hour

Minute * 60

Day

Hour * 24

Week

Day * 7

Note Not all file systems can record creation and last access time and not all file systems record them in the same manner. For example, on the Windows NT FAT file system, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution of 1 day (the access date). On NTFS, access time has a resolution of 1 hour. Furthermore, FAT records times on disk in local time, but NTFS records times on disk in UTC. For more information, see File Times.

Inheritance Hierarchy

FILETIME

CFileTime

Requirements

Header: atltime.h

See Also

Reference

FILETIME

CFileTimeSpan Class

Hierarchy Chart

Other Resources

ATL/MFC Shared Classes