normalize code
[psensor.git] / src / graph.c
index 790e26a..792bb25 100644 (file)
@@ -59,9 +59,10 @@ struct graph_info {
        GdkRGBA theme_fg_color;
 };
 
-
 /* Return the end time of the graph i.e. the more recent measure.  If
  * no measure are available, return 0.
+ * If Bezier curves are used return the measure n-3 to avoid to
+ * display a part of the curve outside the graph area.
  */
 static time_t get_graph_end_time_s(struct psensor **sensors)
 {
@@ -85,8 +86,10 @@ static time_t get_graph_end_time_s(struct psensor **sensors)
                                if (!n) {
                                        t = measures[i].time.tv_sec;
 
-                                       if (t > ret)
+                                       if (t > ret) {
                                                ret = t;
+                                               break;
+                                       }
                                } else {
                                        n--;
                                }