5xxx functions from nbdkit.
[libguestfs-talks.git] / 2020-frama-c / 5200-timeval.html
diff --git a/2020-frama-c/5200-timeval.html b/2020-frama-c/5200-timeval.html
new file mode 100644 (file)
index 0000000..e303af9
--- /dev/null
@@ -0,0 +1,18 @@
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<link rel="stylesheet" href="style.css" type="text/css"/>
+<script src="code.js" type="text/javascript"></script>
+
+<h1>nbdkit tvdiff_usec</h1>
+
+<pre class="code">
+  /* Return the number of µs (microseconds) in y - x. */
+  static inline int64_t
+  tvdiff_usec (const struct timeval *x, const struct timeval *y)
+  {
+    int64_t usec;
+
+    usec = (y->tv_sec - x->tv_sec) * 1000000;
+    usec += y->tv_usec - x->tv_usec;
+    return usec;
+  }
+</pre>