]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/ktime.h
Merge ../ntfs-2.6-devel
[linux-2.6-omap-h63xx.git] / include / linux / ktime.h
index 222a047cc145e8d25c8d68894c86bc390d2a929b..f3dec45ef874d2d40ff883380201eb8d1e540f42 100644 (file)
  *
  *  Started by: Thomas Gleixner and Ingo Molnar
  *
+ *  Credits:
+ *
+ *     Roman Zippel provided the ideas and primary code snippets of
+ *     the ktime_t union and further simplifications of the original
+ *     code.
+ *
  *  For licencing details see kernel-base/COPYING
  */
 #ifndef _LINUX_KTIME_H
@@ -90,10 +96,16 @@ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs)
                ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; })
 
 /* convert a timespec to ktime_t format: */
-#define timespec_to_ktime(ts)          ktime_set((ts).tv_sec, (ts).tv_nsec)
+static inline ktime_t timespec_to_ktime(struct timespec ts)
+{
+       return ktime_set(ts.tv_sec, ts.tv_nsec);
+}
 
 /* convert a timeval to ktime_t format: */
-#define timeval_to_ktime(tv)           ktime_set((tv).tv_sec, (tv).tv_usec * 1000)
+static inline ktime_t timeval_to_ktime(struct timeval tv)
+{
+       return ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC);
+}
 
 /* Map the ktime_t to timespec conversion to ns_to_timespec function */
 #define ktime_to_timespec(kt)          ns_to_timespec((kt).tv64)
@@ -272,8 +284,8 @@ static inline u64 ktime_to_ns(const ktime_t kt)
  * idea of the (in)accuracy of timers. Timer values are rounded up to
  * this resolution values.
  */
-#define KTIME_REALTIME_RES     (NSEC_PER_SEC/HZ)
-#define KTIME_MONOTONIC_RES    (NSEC_PER_SEC/HZ)
+#define KTIME_REALTIME_RES     (ktime_t){ .tv64 = TICK_NSEC }
+#define KTIME_MONOTONIC_RES    (ktime_t){ .tv64 = TICK_NSEC }
 
 /* Get the monotonic time in timespec format: */
 extern void ktime_get_ts(struct timespec *ts);