]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/omapdrmtest.git/blobdiff - util/util.h
mark(): handle one second change properly
[glsdk/omapdrmtest.git] / util / util.h
index bf3323472b5fa92bc9ddb1cba384dad5257db3a9..53b6e1cd1689cc38422fdaceadf0dcacab1f6360 100644 (file)
@@ -78,6 +78,9 @@ void disp_usage(void);
  */
 struct display * disp_open(int argc, char **argv);
 
+/* Close display */
+void disp_close(struct display *disp);
+
 /* Get normal RGB/UI buffers (ie. not scaled, not YUV) */
 static inline struct buffer **
 disp_get_buffers(struct display *disp, uint32_t n)
@@ -186,6 +189,13 @@ mark(long *last)
        gettimeofday(&t, NULL);
        if (last) {
                long delta = t.tv_usec - *last;
+
+               /* Handle the case, where the seconds have changed.
+                * TODO: keep the whole timeval struct, to be able to cope with
+                * more than one second deltas? */
+               if (t.tv_usec < *last)
+                       delta += 1000000;
+
                *last = t.tv_usec;
                return delta;
        }