]> Pileus Git - ~andy/linux/blob - drivers/staging/csr/csr_time.c
Merge branch 'cleanup' into for-linus
[~andy/linux] / drivers / staging / csr / csr_time.c
1 /*****************************************************************************
2
3             (c) Cambridge Silicon Radio Limited 2010
4             All rights reserved and confidential information of CSR
5
6             Refer to LICENSE.txt included with this source for details
7             on the license terms.
8
9 *****************************************************************************/
10
11 #include <linux/kernel.h>
12 #include <linux/version.h>
13
14 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
15 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
16 #include <linux/autoconf.h>
17 #include <linux/config.h>
18 #endif
19
20 #include <linux/time.h>
21 #include <linux/module.h>
22
23 #include "csr_time.h"
24
25 CsrTime CsrTimeGet(CsrTime *high)
26 {
27     struct timespec ts;
28     u64 time;
29     CsrTime low;
30
31     ts = current_kernel_time();
32     time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
33
34     if (high != NULL)
35     {
36         *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF);
37     }
38
39     low = (CsrTime) (time & 0xFFFFFFFF);
40
41     return low;
42 }
43 EXPORT_SYMBOL_GPL(CsrTimeGet);