drm/linux: Add ktime_get_boottime and ktime_ms_delta()
authorFrançois Tigeot <ftigeot@wolfpond.org>
Fri, 11 Nov 2016 11:09:29 +0000 (12:09 +0100)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Fri, 11 Nov 2016 11:19:30 +0000 (12:19 +0100)
sys/dev/drm/include/linux/timekeeping.h

index 14a3cad..e6b352d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 François Tigeot
+ * Copyright (c) 2015-2016 François Tigeot
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -49,4 +49,17 @@ static inline ktime_t ktime_get_real(void)
        return kt;
 }
 
+/* Include time spent in suspend state */
+static inline ktime_t
+ktime_get_boottime(void)
+{
+       return ktime_get_real();
+}
+
+static inline s64
+ktime_ms_delta(const ktime_t later, const ktime_t earlier)
+{
+       return (later.tv64 - earlier.tv64) / NSEC_PER_MSEC;
+}
+
 #endif /* _LINUX_TIMEKEEPING_H_ */