aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c
index 92bd467..d6f1eb3 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
+#include <time.h>
#include "structs.h"
#include "common.h"
@@ -47,8 +48,10 @@ void print_data(struct data * d){
}
void print_front(struct front_item * b){
+ struct front_item * beg = b;
while(b!=NULL){
- printf("%.02f\t%.02f\n",b->i.p,b->i.w);
+ clock_t t = b->time - beg->time;
+ printf("%.02f,\t%.02f,\t%f\n", b->i.p, b->i.w, ((double)t)/CLOCKS_PER_SEC);
b = b->next;
}
}
@@ -73,6 +76,7 @@ struct front_item * new_front_item(double p, double w, struct front_item * prev,
f->i.w = w;
f->next = next;
f->prev = prev;
+ f->time = clock();
return f;
}