From 282d6506bfef93098dd9e2ad3f65e81a230fe1bf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Tigeot?= Date: Sat, 14 Jan 2017 10:34:35 +0100 Subject: [PATCH] drm/linux: Add local_clock() --- sys/dev/drm/include/linux/sched.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/drm/include/linux/sched.h b/sys/dev/drm/include/linux/sched.h index 0e2c7b3571..074d9109b6 100644 --- a/sys/dev/drm/include/linux/sched.h +++ b/sys/dev/drm/include/linux/sched.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 François Tigeot + * Copyright (c) 2015-2017 François Tigeot * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,6 +33,8 @@ #include #include +#include + #define TASK_RUNNING 0 #define TASK_INTERRUPTIBLE 1 #define TASK_UNINTERRUPTIBLE 2 @@ -60,4 +62,16 @@ schedule_timeout(signed long timeout) #define signal_pending(lp) CURSIG(lp) +/* + * local_clock: fast time source, monotonic on the same cpu + */ +static inline uint64_t +local_clock(void) +{ + struct timespec ts; + + getnanouptime(&ts); + return (ts.tv_sec * NSEC_PER_SEC) + ts.tv_nsec; +} + #endif /* _LINUX_SCHED_H_ */ -- 2.11.4.GIT