forked from jontodd/r.refine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtimer.c
executable file
·50 lines (46 loc) · 1.28 KB
/
rtimer.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* ************************************************************
*
* MODULE: r.refine
*
* Authors: Jon Todd <[email protected]>, Laura Toma <[email protected]>
* Bowdoin College, USA
*
* Purpose: convert grid data to TIN
*
* COPYRIGHT:
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
* for details.
*
*
************************************************************ */
/******************************************************************************
*
* rtimer.h format ouput for system timer
*
* AUTHOR(S): Jonathan Todd - <[email protected]>
* Laura Toma - <[email protected]>
*
* UPDATED: jt 2005-08-15
*
* COMMENTS: Based on the rtimer by Laura Toma.
*
*****************************************************************************/
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include "rtimer.h"
char *
rt_sprint_safe(char *buf, Rtimer rt) {
if(rt_w_useconds(rt) == 0) {
sprintf(buf, "%4.2f\t%.1f%%\t",
0.0, 0.0);
} else {
sprintf(buf, "%4.2f\t%.1f%%\t",
rt_w_useconds(rt)/1000000,
100.0*(rt_u_useconds(rt)+rt_s_useconds(rt)) / rt_w_useconds(rt));
}
return buf;
}