//=========================================================================== // SISL - SINTEF Spline Library, version 4.5.0. // Definition and interrogation of NURBS curves and surfaces. // // Copyright (C) 2000-2005, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program 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. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00046 #ifndef MICROSOFT 00047 # include <strings.h> 00048 # include <unistd.h> 00049 #else 00050 # include <stdlib.h> 00051 #endif 00052 00053 #include <time.h> 00054 00055 00056 00057 00058 double jon_timer; 00059 00060 00061 static double jon_sec(void) 00062 { 00063 #ifndef MICROSOFT 00064 #ifdef LINUX 00065 struct timeb jon_ts; 00066 #else 00067 struct timespec jon_ts; 00068 #endif 00069 #else 00070 struct _timeb jon_ts; 00071 #endif 00072 00073 #ifndef MICROSOFT 00074 #ifdef LINUX 00075 ftime(&jon_ts); 00076 return (jon_ts.time + 0.001*jon_ts.millitm); 00077 #else 00078 clock_gettime(CLOCK_REALTIME, &jon_ts); 00079 return (int)(jon_ts.tv_sec) + ((double)(jon_ts.tv_nsec)/1e9); 00080 #endif 00081 #else 00082 _ftime(&jon_ts); 00083 return (jon_ts.time + 0.001*jon_ts.millitm); 00084 #endif 00085 } 00086 00087 00088 void tic(void) 00089 { 00090 jon_timer=jon_sec(); 00091 } 00092 00093 00094 void toc(void) 00095 { 00096 printf("Time elapsed: %f\n", jon_sec()-jon_timer); 00097 }
1.6.3