]> Pileus Git - ~andy/linux/blob - drivers/staging/csr/csr_time.c
Merge branch 'for-3.8/drivers' of git://git.kernel.dk/linux-block
[~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/time.h>
13 #include <linux/module.h>
14
15 #include "csr_time.h"
16
17 u32 CsrTimeGet(u32 *high)
18 {
19         struct timespec ts;
20         u64 time;
21         u32 low;
22
23         ts = current_kernel_time();
24         time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
25
26         if (high != NULL)
27                 *high = (u32) ((time >> 32) & 0xFFFFFFFF);
28
29         low = (u32) (time & 0xFFFFFFFF);
30
31         return low;
32 }
33 EXPORT_SYMBOL_GPL(CsrTimeGet);