22 #ifndef _BLAZE_UTIL_TIME_H_
23 #define _BLAZE_UTIL_TIME_H_
37 # include <sys/timeb.h>
39 # include <sys/resource.h>
40 # include <sys/time.h>
41 # include <sys/types.h>
79 localTime = std::localtime( &t );
80 std::strftime( c, 50,
"%Y-%m-%d", localTime );
82 return std::string( c );
100 localTime = std::localtime( &t );
101 std::strftime( c, 50,
"%A, %d.%B %Y, %H:%M", localTime );
103 return std::string( c );
117 struct _timeb timeptr;
119 return ( static_cast<double>( timeptr.time ) + static_cast<double>( timeptr.millitm )/1E3 );
122 gettimeofday( &tp,
NULL );
123 return ( static_cast<double>( tp.tv_sec ) + static_cast<double>( tp.tv_usec )/1E6 );
138 FILETIME CreateTime, ExitTime, KernelTime, UserTime;
141 if( GetProcessTimes( GetCurrentProcess(), &CreateTime, &ExitTime, &KernelTime, &UserTime ) != TRUE ) {
145 FileTimeToSystemTime( &UserTime, &SysTime );
146 return ( static_cast<double>( SysTime.wSecond ) + static_cast<double>( SysTime.wMilliseconds )/1E3 );
150 getrusage( RUSAGE_SELF, &ruse );
151 return ( static_cast<double>( ruse.ru_utime.tv_sec ) + static_cast<double>( ruse.ru_utime.tv_usec )/1E6 );