From 2b35c4ca4b808dddd06e76fa902a29bb12dfcd0b Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Mon, 2 Feb 2009 08:10:03 +0100 Subject: [PATCH] Make the main function print out the timestamp --- TEMPer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/TEMPer.c b/TEMPer.c index f330870..df2f864 100644 --- a/TEMPer.c +++ b/TEMPer.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #define BAUDRATE B9600 @@ -345,8 +346,6 @@ double ReadTEMP(void) break; } - fprintf(stderr, "Getting temperature done %16s %f\n", buf, temperature); - return temperature; } @@ -391,10 +390,10 @@ int main(int argc, char **argv) Init(); while (1) { - double foo = ReadTEMP(); - -/* printf("%f\n", foo);*/ - usleep(50000); + double temperature = ReadTEMP(); + time_t now = time(NULL); + printf("%s %f\n", ctime(&now), temperature); + sleep(1); } return 0; } -- 2.39.5