From: Tollef Fog Heen Date: Mon, 2 Feb 2009 07:10:03 +0000 (+0100) Subject: Make the main function print out the timestamp X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b35c4ca4b808dddd06e76fa902a29bb12dfcd0b;p=temper Make the main function print out the timestamp --- 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; }