]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/time.h
[PATCH] audit: AUDIT_PERM support
[linux-2.6-omap-h63xx.git] / include / linux / time.h
index 65dd85b2105e61c892120ad84cfe77ceabe42b7b..a5b739967b74f46f745526952b1c947c236cf75a 100644 (file)
@@ -28,10 +28,13 @@ struct timezone {
 #ifdef __KERNEL__
 
 /* Parameters used to convert the timespec values: */
-#define MSEC_PER_SEC           1000L
-#define USEC_PER_SEC           1000000L
-#define NSEC_PER_SEC           1000000000L
-#define NSEC_PER_USEC          1000L
+#define MSEC_PER_SEC   1000L
+#define USEC_PER_MSEC  1000L
+#define NSEC_PER_USEC  1000L
+#define NSEC_PER_MSEC  1000000L
+#define USEC_PER_SEC   1000000L
+#define NSEC_PER_SEC   1000000000L
+#define FSEC_PER_SEC   1000000000000000L
 
 static inline int timespec_equal(struct timespec *a, struct timespec *b)
 {
@@ -67,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:
  */