QR_MUMPS
qrm_get_wtime.c
Go to the documentation of this file.
1 /* ##############################################################################################
2 **
3 ** Copyright 2012 CNRS, INPT
4 **
5 ** This file is part of qr_mumps.
6 **
7 ** qr_mumps is free software: you can redistribute it and/or modify
8 ** it under the terms of the GNU Lesser General Public License as
9 ** published by the Free Software Foundation, either version 3 of
10 ** the License, or (at your option) any later version.
11 **
12 ** qr_mumps is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU Lesser General Public License for more details.
16 **
17 ** You can find a copy of the GNU Lesser General Public License
18 ** in the qr_mumps/doc directory.
19 **
20 ** ##############################################################################################*/
21 
22 
23 /*##############################################################################################*/
33 /*##############################################################################################*/
34 
35 
36 #include <sys/time.h>
37 #include <stdio.h>
38 #include <unistd.h>
39 
40 double qrm_swtime()
41 {
42  struct timeval tp;
43  struct timezone tzp;
44  int i;
45 
46  i = gettimeofday(&tp,&tzp);
47  return ( (double) tp.tv_sec + (double) tp.tv_usec * 1.e-6 );
48 
49 }
50 
51 
52 double qrm_uwtime(){
53  struct timeval t;
54  struct timezone tzp;
55 
56  gettimeofday(&t,&tzp);
57  return (double) t.tv_sec*1000000+t.tv_usec;
58 
59 }
60 
61 
62 
63 void qrm_msleep(int n){
64 
65  struct timespec req={0},rem={0};
66  time_t sec=(int)(n/1000);
67  n=n-(sec*1000);
68  req.tv_sec=sec;
69  req.tv_nsec=n*1000000L;
70  nanosleep(&req,&rem);
71  return;
72 }
double qrm_swtime()
Definition: qrm_get_wtime.c:40
double qrm_uwtime()
Definition: qrm_get_wtime.c:52
void qrm_msleep(int n)
Definition: qrm_get_wtime.c:63
int i
Definition: secs.c:40