kyuseo의 게임 프로그래밍

GetFileTime & SetFileTime & WriteTime 의 시간 오차 본문

C++ 개발

GetFileTime & SetFileTime & WriteTime 의 시간 오차

kyuseo 2008. 1. 4. 20:20

개요..

 

파일의 날짜와 시간을 설정하는 GetFileTime과 SetFileTime함수는 파일 시스템에 따라서 시간 오차가 생길 수 있습니다.

 

특히 WriteTime 함수는 2초가량의 오차가 발생되므로 사용시 많은 주의가 필요합니다.

 

 

압축 프로그램 역시 시간 오차가 많이 발생하는 프로그램 입니다. 특히 공개된 압축 ZLib 소스는 오차가 존재하지요.

 

 

 

참고

 

Remarks

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 Windows NT FAT, 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 (really, the access date). On NTFS, access time has a resolution of 1 hour. Therefore, the GetFileTime function may not return the same file time information set using SetFileTime. Furthermore, FAT records times on disk in local time. However, NTFS records times on disk in UTC. For more information, see File Times.

   

   

SetFileTime

 

The SetFileTime function sets the date and time that a file was created, last accessed, or last modified.

 

GetFileTime

   

The GetFileTime function retrieves the date and time that a file was created, last accessed, and last modified.