-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.c
executable file
·54 lines (48 loc) · 1.13 KB
/
help.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
51
52
53
/*
============================================================================
Name : help.c
Author : Julian Fietkau
Copyright : Julian Fietkau
Description : some functions 5 getting work done
============================================================================
*/
#include <time.h>
#include <stdio.h>
#include "help.h"
#include <sys/time.h>
int isANumber(char value) {
// ASCII : 0 = 48, 9 = 57
if ((47 < value) && (value < 58)) {
return 1;
}
return 0;
}
int isPartOfNumber(char value) {
if ((47 < value) && (value < 58)) { // ASCII : 0 = 48, 9 = 57
return 1;
}
if (value == 46) { // Char is a point
return 1;
}
return 0;
}
/*
***************** Implements a small timestop function with milliseconds ***********
*/
struct timeval start,stop;
/*
* start a clock
* clock() falsified the results by multithreading
*/
void run_timer() {
gettimeofday(&start, NULL);
// time(&start);
}
/*
* reset timer and return bygone time
*/
void stop_timer() {
gettimeofday(&stop, NULL);
last_measured_time = difftime(stop.tv_sec, start.tv_sec)
+ (difftime(stop.tv_usec,start.tv_usec)/1000000);
}