(file) Return to TimeValue.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/TimeValue.cpp between version 1.1 and 1.2

version 1.1, 2001/04/10 23:01:52 version 1.2, 2001/04/11 00:23:44
Line 23 
Line 23 
 // Author: Michael E. Brasher // Author: Michael E. Brasher
 // //
 // $Log$ // $Log$
   // Revision 1.2  2001/04/11 00:23:44  mike
   // new files
   //
 // Revision 1.1  2001/04/10 23:01:52  mike // Revision 1.1  2001/04/10 23:01:52  mike
 // Added new TimeValue class and regression tests for it. // Added new TimeValue class and regression tests for it.
 // Modified Stopwatch class to use TimeValue class. // Modified Stopwatch class to use TimeValue class.
Line 35 
Line 38 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 #include <cstdio>  
 #include <cstdlib>  
   
 #ifdef PEGASUS_OS_TYPE_WINDOWS  
 # include <windows.h>  
 # include <sys/types.h>  
 # include <sys/timeb.h>  
 #elif PEGASUS_OS_TYPE_UNIX  
 # include <time.h>  
 #elif  
 # error not implemented on this platform  
 #endif  
   
 void _GetCurrentTime(Uint32& seconds, Uint32& milliseconds)  
 {  
 #ifdef PEGASUS_OS_TYPE_UNIX  
     timeval tv;  
     gettimeofday(&tv, 0);  
     seconds  = (int)tv.tv_sec;  
     milliseconds = (int)tv.tvusec;  
 #else  
     FILETIME ft;  
     GetSystemTimeAsFileTime(&ft);  
     ULARGE_INTEGER largeInt = { ft.dwLowDateTime, ft.dwHighDateTime };  
     largeInt.QuadPart -= 0x19db1ded53e8000;  
     seconds = long(largeInt.QuadPart / (10000 * 1000));  
     milliseconds = long((largeInt.QuadPart % (10000 * 1000)) / 10);  
 #endif  
 }  
   
 TimeValue TimeValue::getCurrentTime()  
 {  
     Uint32 seconds;  
     Uint32 milliseconds;  
     _GetCurrentTime(seconds, milliseconds);  
     return TimeValue(seconds, milliseconds);  
 }  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2