]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/dccp/timer.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6-omap-h63xx.git] / net / dccp / timer.c
index 0197a41c256ad72e37499f631f6df40498d4dad6..3af067354bd4ec531ab61f2b22cf4ecd01028552 100644 (file)
@@ -291,3 +291,24 @@ void dccp_init_xmit_timers(struct sock *sk)
        inet_csk_init_xmit_timers(sk, &dccp_write_timer, &dccp_delack_timer,
                                  &dccp_keepalive_timer);
 }
+
+static ktime_t dccp_timestamp_seed;
+/**
+ * dccp_timestamp  -  10s of microseconds time source
+ * Returns the number of 10s of microseconds since loading DCCP. This is native
+ * DCCP time difference format (RFC 4340, sec. 13).
+ * Please note: This will wrap around about circa every 11.9 hours.
+ */
+u32 dccp_timestamp(void)
+{
+       s64 delta = ktime_us_delta(ktime_get_real(), dccp_timestamp_seed);
+
+       do_div(delta, 10);
+       return delta;
+}
+EXPORT_SYMBOL_GPL(dccp_timestamp);
+
+void __init dccp_timestamping_init(void)
+{
+       dccp_timestamp_seed = ktime_get_real();
+}