/*****************************************************************************1*2* Elmer, A Finite Element Software for Multiphysical Problems3*4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Public License8* as published by the Free Software Foundation; either version 29* of the License, or (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program (in file fem/GPL-2); if not, write to the18* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,19* Boston, MA 02110-1301, USA.20*21*****************************************************************************/2223/*******************************************************************************24*25* Provide system time.26*27*******************************************************************************28*29* Author: Juha Ruokolainen30*31* Address: CSC - IT Center for Science Ltd.32* Keilaranta 14, P.O. BOX 40533* 02101 Espoo, Finland34* Tel. +358 0 457 272335* Telefax: +358 0 457 230236* EMail: [email protected]37*38* Date: 26 Sep 199539*40* Modified by:41*42* Date of modification:43*44******************************************************************************/454647#include "../config.h"48#ifndef WIN324950#include <sys/types.h>51#include <sys/times.h>52#include <sys/param.h>5354#include <sys/time.h>55#include <sys/resource.h>5657static struct tms t;58static struct rusage usage;5960static struct timeval tp;61static struct timezone tzp;6263double CPUTime( )64{65getrusage( RUSAGE_SELF, &usage );66return (double) usage.ru_utime.tv_sec + usage.ru_utime.tv_usec*1.0e-6;67}6869double RealTime( )70{71gettimeofday( &tp,&tzp );72return tp.tv_sec + tp.tv_usec*1.0e-6;73}7475#else7677#include <sys/types.h>78#include <time.h>7980double CPUTime() { return 0.0; }8182double RealTime()83{84return clock() / (double)CLOCKS_PER_SEC;85}8687#endif888990