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