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__BSD__MICRO_TIME_HPP_ 00035 #define _THREADS_1__BSD__MICRO_TIME_HPP_ 00036 00037 #include <sys/types.h> 00038 #include <sys/time.h> 00039 00040 #include <threads_1/h/micro_time.hpp> 00041 00042 namespace threads_1 00043 { 00044 00045 namespace micro_time 00046 { 00047 00053 inline unix_t 00054 _os_get() 00055 { 00056 struct timeval tv; 00057 struct timezone tz; 00058 00059 gettimeofday( &tv, &tz ); 00060 00061 return unix_t( 00062 // Определяем, сколько прошло секунд. 00063 tv.tv_sec, 00064 // А сколько микросекунд. 00065 tv.tv_usec ); 00066 } 00067 00068 } /* namespace micro_time */ 00069 00070 } /* namespace threads_1 */ 00071 00072 #endif