All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] backports: add ktime_get_seconds()
@ 2015-10-23  7:23 Johannes Berg
  2015-10-23  9:32 ` Arend van Spriel
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2015-10-23  7:23 UTC (permalink / raw)
  To: backports; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/ktime.h       |  1 +
 backport/backport-include/linux/timekeeping.h | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 backport/backport-include/linux/timekeeping.h

diff --git a/backport/backport-include/linux/ktime.h b/backport/backport-include/linux/ktime.h
index 6fbc6c6eb26c..33ed31caf01a 100644
--- a/backport/backport-include/linux/ktime.h
+++ b/backport/backport-include/linux/ktime.h
@@ -1,6 +1,7 @@
 #ifndef __BACKPORT_LINUX_KTIME_H
 #define __BACKPORT_LINUX_KTIME_H
 #include_next <linux/ktime.h>
+#include <linux/timekeeping.h>
 #include <linux/version.h>
 
 #if  LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
diff --git a/backport/backport-include/linux/timekeeping.h b/backport/backport-include/linux/timekeeping.h
new file mode 100644
index 000000000000..25ca76b5f802
--- /dev/null
+++ b/backport/backport-include/linux/timekeeping.h
@@ -0,0 +1,21 @@
+#ifndef __BACKPORT_TIMKEEPING_H
+#define __BACKPORT_TIMKEEPING_H
+#include <linux/version.h>
+#include <linux/types.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
+#include_next <linux/timekeeping.h>
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
+static inline time_t ktime_get_seconds(void)
+{
+	struct timespec t;
+
+	ktime_get_ts(&t);
+
+	return t.tv_sec;
+}
+#endif
+
+#endif /* __BACKPORT_TIMKEEPING_H */
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] backports: add ktime_get_seconds()
  2015-10-23  7:23 [PATCH] backports: add ktime_get_seconds() Johannes Berg
@ 2015-10-23  9:32 ` Arend van Spriel
  2015-10-23  9:34   ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Arend van Spriel @ 2015-10-23  9:32 UTC (permalink / raw)
  To: Johannes Berg, backports; +Cc: Johannes Berg

On 10/23/2015 09:23 AM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>

Already submitted a patch for this. I just did not bother to introduce 
the timekeeping.h file. So yours may be preferred.

Regards,
Arend

> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>   backport/backport-include/linux/ktime.h       |  1 +
>   backport/backport-include/linux/timekeeping.h | 21 +++++++++++++++++++++
>   2 files changed, 22 insertions(+)
>   create mode 100644 backport/backport-include/linux/timekeeping.h
>
> diff --git a/backport/backport-include/linux/ktime.h b/backport/backport-include/linux/ktime.h
> index 6fbc6c6eb26c..33ed31caf01a 100644
> --- a/backport/backport-include/linux/ktime.h
> +++ b/backport/backport-include/linux/ktime.h
> @@ -1,6 +1,7 @@
>   #ifndef __BACKPORT_LINUX_KTIME_H
>   #define __BACKPORT_LINUX_KTIME_H
>   #include_next <linux/ktime.h>
> +#include <linux/timekeeping.h>
>   #include <linux/version.h>
>
>   #if  LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)
> diff --git a/backport/backport-include/linux/timekeeping.h b/backport/backport-include/linux/timekeeping.h
> new file mode 100644
> index 000000000000..25ca76b5f802
> --- /dev/null
> +++ b/backport/backport-include/linux/timekeeping.h
> @@ -0,0 +1,21 @@
> +#ifndef __BACKPORT_TIMKEEPING_H
> +#define __BACKPORT_TIMKEEPING_H
> +#include <linux/version.h>
> +#include <linux/types.h>
> +
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)
> +#include_next <linux/timekeeping.h>
> +#endif
> +
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
> +static inline time_t ktime_get_seconds(void)
> +{
> +	struct timespec t;
> +
> +	ktime_get_ts(&t);
> +
> +	return t.tv_sec;
> +}
> +#endif
> +
> +#endif /* __BACKPORT_TIMKEEPING_H */
>

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] backports: add ktime_get_seconds()
  2015-10-23  9:32 ` Arend van Spriel
@ 2015-10-23  9:34   ` Johannes Berg
  2015-10-23 11:17     ` Arend van Spriel
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2015-10-23  9:34 UTC (permalink / raw)
  To: Arend van Spriel, backports

On Fri, 2015-10-23 at 11:32 +0200, Arend van Spriel wrote:
> On 10/23/2015 09:23 AM, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> 
> Already submitted a patch for this. I just did not bother to 
> introduce the timekeeping.h file. So yours may be preferred.
> 

Oh, missed that. Yours is better with time64_t though, so we should
probably merge them...

Adding the timekeeping.h file might be required if, in the future,
somebody includes only it instead of ktime.h

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] backports: add ktime_get_seconds()
  2015-10-23  9:34   ` Johannes Berg
@ 2015-10-23 11:17     ` Arend van Spriel
  0 siblings, 0 replies; 4+ messages in thread
From: Arend van Spriel @ 2015-10-23 11:17 UTC (permalink / raw)
  To: Johannes Berg, backports

On 10/23/2015 11:34 AM, Johannes Berg wrote:
> On Fri, 2015-10-23 at 11:32 +0200, Arend van Spriel wrote:
>> On 10/23/2015 09:23 AM, Johannes Berg wrote:
>>> From: Johannes Berg <johannes.berg@intel.com>
>>
>> Already submitted a patch for this. I just did not bother to
>> introduce the timekeeping.h file. So yours may be preferred.
>>
>
> Oh, missed that. Yours is better with time64_t though, so we should
> probably merge them...

Be my guest ;-)

> Adding the timekeeping.h file might be required if, in the future,
> somebody includes only it instead of ktime.h

Yeah. I got the impression that timekeeping.h should not be included 
directly, but that might not stop people from doing it anyway.

Regards,
Arend

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-23 11:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23  7:23 [PATCH] backports: add ktime_get_seconds() Johannes Berg
2015-10-23  9:32 ` Arend van Spriel
2015-10-23  9:34   ` Johannes Berg
2015-10-23 11:17     ` Arend van Spriel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.