]> err.no Git - temper/commitdiff
Make the main function print out the timestamp
authorTollef Fog Heen <tfheen@err.no>
Mon, 2 Feb 2009 07:10:03 +0000 (08:10 +0100)
committerTollef Fog Heen <tfheen@err.no>
Mon, 2 Feb 2009 07:10:17 +0000 (08:10 +0100)
TEMPer.c

index f33087055319bae5ca196cffe3ce360c243a1ef7..df2f86481ef2239dc5cdfd55fe26390ec7136b92 100644 (file)
--- a/TEMPer.c
+++ b/TEMPer.c
@@ -7,6 +7,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <time.h>
 #include <math.h>
 
 #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;
 }