00001 //---------------------------------------------------------------------------- 00002 /** @file SgTime.h 00003 Time measurement. 00004 */ 00005 //---------------------------------------------------------------------------- 00006 00007 #ifndef SG_TIME_H 00008 #define SG_TIME_H 00009 00010 #include <string> 00011 00012 //---------------------------------------------------------------------------- 00013 00014 /** Time measurement mode used in SgTime. */ 00015 enum SgTimeMode 00016 { 00017 /** Measure CPU-time. 00018 Returns the CPU time of the current thread including child processes. 00019 */ 00020 SG_TIME_CPU, 00021 00022 /** Measure real time. */ 00023 SG_TIME_REAL 00024 }; 00025 00026 //---------------------------------------------------------------------------- 00027 00028 /** Get current time, and formatting functions */ 00029 namespace SgTime 00030 { 00031 /** Format time as MM:SS. */ 00032 std::string Format(double time, bool minsAndSecs = true); 00033 00034 /** Get time using the default mode. */ 00035 double Get(); 00036 00037 /** Get time using explicit mode. */ 00038 double Get(SgTimeMode mode); 00039 00040 /** Return current default time mode. */ 00041 SgTimeMode DefaultMode(); 00042 00043 /** Set default time mode. */ 00044 void SetDefaultMode(SgTimeMode mode); 00045 00046 std::string TodaysDate(); 00047 } 00048 00049 //---------------------------------------------------------------------------- 00050 00051 #endif // SG_TIME_H