ccsoft  0.0.0
Convolutional codes library with soft decision decoding
/shared/development/google_code/rssoft/libccsoft/lib/Debug.h
Go to the documentation of this file.
00001 /*
00002  Copyright 2013 Edouard Griffiths <f4exb at free dot fr>
00003 
00004  This file is part of RSSoft. A Reed-Solomon Soft Decoding library
00005 
00006  This program is free software; you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation; either version 2 of the License, or
00009  (at your option) any later version.
00010 
00011  This program is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with this program; if not, write to the Free Software
00018  Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
00019 
00020  Debug log output macro
00021 
00022 */
00023 #ifndef __DEBUG_H__
00024 #define __DEBUG_H__
00025 
00026 #include <time.h>
00027 
00028 #ifdef _DEBUG
00029 #define DEBUG_OUT(condition, str) if (condition) { std::cout << str; };
00030 #else
00031 #define DEBUG_OUT(condition, str) 
00032 #endif
00033 
00034 // time difference in seconds
00035 double debug_get_time_difference(const timespec& time1, const timespec& time2)
00036 {
00037     long long unsigned int time1_ns = time1.tv_sec * 1000000000ull + time1.tv_nsec;
00038     long long unsigned int time2_ns = time2.tv_sec * 1000000000ull + time2.tv_nsec;
00039 
00040     if (time1_ns > time2_ns)
00041     {
00042         return ((double) time1_ns - time2_ns) / 1e9;
00043     }
00044     else
00045     {
00046         return ((double) time2_ns - time1_ns) / 1e9;
00047     }
00048 }
00049 
00050 #endif // __DEBUG_H__
00051  
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines