]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/time.h
[PATCH] per-task-delay-accounting: setup
[linux-2.6-omap-h63xx.git] / include / linux / time.h
index c05f8bb9a323d575853350cc0b8b5e9baf1d939d..a5b739967b74f46f745526952b1c947c236cf75a 100644 (file)
@@ -70,6 +70,18 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
 
 extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
 
+/*
+ * sub = lhs - rhs, in normalized form
+ */
+static inline struct timespec timespec_sub(struct timespec lhs,
+                                               struct timespec rhs)
+{
+       struct timespec ts_delta;
+       set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec,
+                               lhs.tv_nsec - rhs.tv_nsec);
+       return ts_delta;
+}
+
 /*
  * Returns true if the timespec is norm, false if denorm:
  */