// CurrentMsTime.h: interface for the CCurrentMsTime class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_CURRENTMSTIME_H__008B9E67_97A4_4B6E_A2DE_9EFA119208E3__INCLUDED_) #define AFX_CURRENTMSTIME_H__008B9E67_97A4_4B6E_A2DE_9EFA119208E3__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #ifdef BUILD_MCCTRDLL #define MCCTRDLLCLASS __declspec(dllexport) #else #define MCCTRDLLCLASS __declspec(dllimport) #endif // Note : this class might not work after year 2038! // this is because _ftime() returns a long data type since midnight(00:00:00), January 1, 1970 // The long data type will become a negative value after 2038AD // long data type is 32 bit // 32 bit value = 2^32 = 4294967296 // Max long data type positive value = (32 bit value / 2) - 1 = (4294967296 / 2) - 1 // = 2147483647 // secs in a year = 24hrs * 60Min * 60sec * 365.25 days = 31557600 secs // No of years long data type can represent = Max long data type positive value/secs in a year // = 2147483647 / 31557600 = 68 years // Therefore Max year a long data type can represent since midnight(00:00:00), January 1, 1970 // = 1970 + 68 = 2038 AD // By 2038AD i should have retired! Have u? class MCCTRDLLCLASS CCurrentMsTime { public: // Update Current Time static void UpdateCurrentTime(); // get current time static LONGLONG GetCurrentTime(); // get time in seconds static double CalTimeSpanInSec(LONGLONG ullMsTime); // get time in minutes static double CalTimeSpanInMin(LONGLONG ullMsTime); // get time in hours static double CalTimeSpanInHr(LONGLONG ullMsTime); private: // private constructor, this class should not be instantiated CCurrentMsTime(); // default destructor virtual ~CCurrentMsTime(); // Current Time static LONGLONG m_lCurrentTime; }; #endif // !defined(AFX_CURRENTMSTIME_H__008B9E67_97A4_4B6E_A2DE_9EFA119208E3__INCLUDED_)