Титульная страница | Пространства имен | Алфавитный указатель | Классы | Файлы | Члены пространства имен | Члены классов | Описания | Примеры

threads_1/h/micro_time.hpp

См. документацию.
00001 /* 00002 00003 threads_1: Multithreading support library 00004 Yauheni A. Akhotnikau (C) 2002-2004 00005 eao197@yahoo.com 00006 ------------------------------------------------- 00007 00008 Permission is granted to anyone to use this software for any purpose on any 00009 computer system, and to redistribute it freely, subject to the following 00010 restrictions: 00011 00012 1. This software is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 00016 2. The origin of this software must not be misrepresented, either by 00017 explicit claim or by omission. 00018 00019 3. Altered versions must be plainly marked as such, and must not be 00020 misrepresented as being the original software. 00021 00022 ------------------------------------------------- 00023 00024 */ 00025 /* 00026 Threads 1 00027 */ 00028 00034 #ifndef _THREADS_1__MICRO_TIME_HPP_ 00035 #define _THREADS_1__MICRO_TIME_HPP_ 00036 00037 #include <iostream> 00038 00039 #include <time.h> 00040 00041 #include <threads_1/h/declspec.hpp> 00042 00043 namespace threads_1 00044 { 00045 00051 namespace micro_time 00052 { 00053 00054 // 00055 // unix_t 00056 // 00057 00070 struct THREADS_1__TYPE unix_t 00071 { 00073 time_t m_sec; 00075 unsigned long m_microsec; 00076 00078 inline 00079 unix_t() 00080 : m_sec( 0 ) 00081 , m_microsec( 0 ) 00082 {} 00084 inline 00085 unix_t( 00086 time_t sec, 00087 unsigned long microsec ) 00088 : m_sec( sec ) 00089 , m_microsec( microsec ) 00090 {} 00091 00093 static unix_t 00094 get(); 00095 00099 inline bool 00100 operator==( const unix_t & o ) const 00101 { 00102 return ( m_sec == o.m_sec && m_microsec == o.m_microsec ); 00103 } 00104 00106 inline bool 00107 operator!=( const unix_t & o ) const 00108 { 00109 return ( m_sec != o.m_sec || m_microsec != o.m_microsec ); 00110 } 00111 00113 inline bool 00114 operator<( const unix_t & o ) const 00115 { 00116 return ( m_sec < o.m_sec || 00117 ( m_sec == o.m_sec && m_microsec < o.m_microsec ) ); 00118 } 00119 00121 inline bool 00122 operator<=( const unix_t & o ) const 00123 { 00124 return ((*this) < o) || ((*this) == o); 00125 } 00126 00128 inline bool 00129 operator>( const unix_t & o ) const 00130 { 00131 return ( m_sec > o.m_sec || 00132 ( m_sec == o.m_sec && m_microsec > o.m_microsec ) ); 00133 } 00134 00136 inline bool 00137 operator>=( const unix_t & o ) const 00138 { 00139 return ((*this) > o) || ((*this) == o); 00140 } 00142 }; 00143 00144 // 00145 // default_string 00146 // 00147 00174 struct default_string 00175 { 00177 enum conversion_t 00178 { 00180 local, 00182 utc 00183 }; 00184 00185 const unix_t & m_what; 00186 conversion_t m_conversion; 00187 00188 explicit default_string( 00189 const unix_t & what, 00190 const conversion_t & conversion = local ) 00191 : m_what( what ) 00192 , m_conversion( conversion ) 00193 {} 00194 }; 00195 00196 // 00197 // default_string_dumper 00198 // 00199 00205 THREADS_1__FUNC(std::ostream &) 00206 default_string_dumper( std::ostream & to, const default_string & what ); 00207 00208 inline std::ostream & 00209 operator<<( std::ostream & o, const default_string & what ) 00210 { 00211 return default_string_dumper( o, what ); 00212 } 00213 00214 inline std::ostream & 00215 operator<<( std::ostream & to, const unix_t & what ) 00216 { 00217 return ( to << default_string( what ) ); 00218 } 00219 00220 } /* namespace micro_time */ 00221 00222 } /* namespace threads_1 */ 00223 00224 #endif

Документация по threads_1. Последние изменения: Wed Aug 4 06:46:01 2004. Создано системой doxygen 1.3.7
Hosted by uCoz