From: Daniel Borkmann <dborkman@redhat.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: [PATCH net-next 2/5] ktime: add ms_to_ktime() and ktime_add_ms() helpers
Date: Tue, 18 Jun 2013 10:55:17 +0200 [thread overview]
Message-ID: <1371545720-22950-3-git-send-email-dborkman@redhat.com> (raw)
In-Reply-To: <1371545720-22950-1-git-send-email-dborkman@redhat.com>
Add two ktime helper functions that i) convert a given msec value to
a ktime structure and ii) that adds a msec value to a ktime structure.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
include/linux/ktime.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index bbca128..b4fa5e4 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -323,6 +323,11 @@ static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
return ktime_add_ns(kt, usec * 1000);
}
+static inline ktime_t ktime_add_ms(const ktime_t kt, const u64 msec)
+{
+ return ktime_add_ns(kt, msec * NSEC_PER_MSEC);
+}
+
static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
{
return ktime_sub_ns(kt, usec * 1000);
@@ -366,7 +371,15 @@ extern void ktime_get_ts(struct timespec *ts);
static inline ktime_t ns_to_ktime(u64 ns)
{
static const ktime_t ktime_zero = { .tv64 = 0 };
+
return ktime_add_ns(ktime_zero, ns);
}
+static inline ktime_t ms_to_ktime(u64 ms)
+{
+ static const ktime_t ktime_zero = { .tv64 = 0 };
+
+ return ktime_add_ms(ktime_zero, ms);
+}
+
#endif
--
1.7.11.7
next prev parent reply other threads:[~2013-06-18 8:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-18 8:55 [PATCH net-next 0/5] Further SCTP changes Daniel Borkmann
2013-06-18 8:55 ` [PATCH net-next 1/5] net: sctp: remove TEST_FRAME ifdef Daniel Borkmann
2013-06-18 8:55 ` Daniel Borkmann [this message]
2013-06-18 8:55 ` [PATCH net-next 3/5] net: sctp: migrate cookie life from timeval to ktime Daniel Borkmann
2013-06-18 8:55 ` [PATCH net-next 4/5] net: sctp: decouple cleaning socket data from endpoint Daniel Borkmann
2013-06-18 14:22 ` Neil Horman
2013-06-18 16:02 ` Daniel Borkmann
2013-06-18 16:24 ` Vlad Yasevich
2013-06-18 17:45 ` Neil Horman
2013-06-18 18:15 ` Vlad Yasevich
2013-06-18 19:12 ` Neil Horman
2013-06-18 22:55 ` Vlad Yasevich
2013-06-19 11:55 ` Neil Horman
2013-06-20 14:35 ` Vlad Yasevich
2013-06-20 17:29 ` Daniel Borkmann
2013-06-21 1:12 ` Vlad Yasevich
2013-06-22 21:38 ` Daniel Borkmann
2013-06-18 8:55 ` [PATCH net-next 5/5] net: sctp: minor: sctp_seq_dump_local_addrs add missing newline Daniel Borkmann
2013-06-20 1:39 ` [PATCH net-next 0/5] Further SCTP changes David Miller
2013-06-20 13:24 ` Neil Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1371545720-22950-3-git-send-email-dborkman@redhat.com \
--to=dborkman@redhat.com \
--cc=davem@davemloft.net \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).