언리얼에서 Tick 으로 넘어오는 파람이 deltaTime 이다. 그런데 이 값을 더한 누적 시간이 부동 소수점 오차 때문인지 실제 지난 시간 값과 동일하지는 않는 경우가 있었다. ex) 1시간 마다 보여줘야하는 메시지에 59분 지남이라는 메시지가 보였다. 이런 경우에 윈도우에서 GetTickCount, QueryPerformanceCounter 같은 함수를 이용해 timestamp 를 가지고 이용했으면 하는데 인터페이스를 못찾고 있었다. FPlatformTime 이라는 클래스를 이용하면 되는 듯...

 

FPlatformTime 은 typedef 로 플랫폼 별로 FGenericPlatformTime 을 포팅한 class 를 가리키고 있다.

 

typedef FWindowsPlatformTime FPlatformTime;

 

다음 API로 timestamp를 가져올 수 있다.

 

float FPlatformTime::Seconds()


FWindowsPlatformTime 은 QueryPerformanceCounter 를 이용하여 구현되어 있다.

728x90

+ Recent posts