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

sample/micro_time/main.cpp

/* threads_1: Multithreading support library Yauheni A. Akhotnikau (C) 2002-2004 eao197@yahoo.com ------------------------------------------------- Permission is granted to anyone to use this software for any purpose on any computer system, and to redistribute it freely, subject to the following restrictions: 1. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 2. The origin of this software must not be misrepresented, either by explicit claim or by omission. 3. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software. ------------------------------------------------- */ /* Threads 1 */ /* Демонстрация работы с threads_1::micro_time. */ #include <iostream> #include <time.h> #include <threads_1/h/micro_time.hpp> void test_speed() { threads_1::micro_time::unix_t s = threads_1::micro_time::unix_t::get(); for( unsigned int i = 0; i != 100000; ++i ) { threads_1::micro_time::unix_t t = threads_1::micro_time::unix_t::get(); } threads_1::micro_time::unix_t f = threads_1::micro_time::unix_t::get(); std::cout << "start: " << s << "\n" "finish: " << f << std::endl; } int main() { threads_1::micro_time::unix_t m = threads_1::micro_time::unix_t::get(); time_t t = time( 0 ); std::cout << "micro_time: " << threads_1::micro_time::default_string( m ) << "\n" "localtime: " << asctime( localtime( &t ) ) << std::endl; std::cout << "UTC micro_time: " << threads_1::micro_time::default_string( m, threads_1::micro_time::default_string::utc ) << "\n" "UTC localtime: " << asctime( gmtime( &t ) ) << std::endl; test_speed(); return 0; }
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 00029 /* 00030 Демонстрация работы с threads_1::micro_time. 00031 */ 00032 00033 #include <iostream> 00034 00035 #include <time.h> 00036 00037 #include <threads_1/h/micro_time.hpp> 00038 00039 void 00040 test_speed() 00041 { 00042 threads_1::micro_time::unix_t s = threads_1::micro_time::unix_t::get(); 00043 00044 for( unsigned int i = 0; i != 100000; ++i ) 00045 { 00046 threads_1::micro_time::unix_t t = 00047 threads_1::micro_time::unix_t::get(); 00048 } 00049 00050 threads_1::micro_time::unix_t f = threads_1::micro_time::unix_t::get(); 00051 std::cout << "start: " << s << "\n" "finish: " << f << std::endl; 00052 } 00053 00054 int 00055 main() 00056 { 00057 threads_1::micro_time::unix_t m = threads_1::micro_time::unix_t::get(); 00058 time_t t = time( 0 ); 00059 00060 std::cout << "micro_time: " 00061 << threads_1::micro_time::default_string( m ) 00062 << "\n" "localtime: " << asctime( localtime( &t ) ) << std::endl; 00063 00064 std::cout << "UTC micro_time: " 00065 << threads_1::micro_time::default_string( m, 00066 threads_1::micro_time::default_string::utc ) 00067 << "\n" "UTC localtime: " << asctime( gmtime( &t ) ) << std::endl; 00068 00069 test_speed(); 00070 00071 return 0; 00072 }

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