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

threads_1/win32/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__WIN32__MICRO_TIME_HPP_ 00035 #define _THREADS_1__WIN32__MICRO_TIME_HPP_ 00036 00037 #define WIN32_LEAN_AND_MEAN 00038 #include <windows.h> 00039 00040 #include <threads_1/h/micro_time.hpp> 00041 00042 namespace threads_1 00043 { 00044 00045 namespace micro_time 00046 { 00047 00052 inline unix_t 00053 _os_get() 00054 { 00055 typedef unsigned __int64 uint64_type; 00056 00057 // Смещение UNIX-эпохи (1970.01.01 00:00:00) от Win32-эпохи 00058 // (1601.01.01 00:00:00). 00059 const uint64_type delta = 00060 (((uint64_type) 0x019DB1DE) << 32) | 00061 ((uint64_type) 0xD53E8000); 00062 00063 // Определяем текущее время. 00064 FILETIME ft_current; 00065 GetSystemTimeAsFileTime( &ft_current ); 00066 00067 uint64_type current = 00068 ((((uint64_type) ft_current.dwHighDateTime) << 32) | 00069 ((uint64_type) ft_current.dwLowDateTime)) - delta; 00070 00071 return unix_t( 00072 // Определяем, сколько прошло секунд. 00073 (time_t)( ( current ) / 10000000 ), 00074 // А сколько микросекунд. 00075 (unsigned long)( ( current % 10000000 + 5 ) / 10 ) ); 00076 } 00077 00078 } /* namespace micro_time */ 00079 00080 } /* namespace threads_1 */ 00081 00082 #endif

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