1 /*****************************************************************************
3 (c) Cambridge Silicon Radio Limited 2010
4 All rights reserved and confidential information of CSR
6 Refer to LICENSE.txt included with this source for details
9 *****************************************************************************/
11 #include <linux/kernel.h>
12 #include <linux/version.h>
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>
20 #include <linux/time.h>
21 #include <linux/module.h>
23 #include "csr_types.h"
26 CsrTime CsrTimeGet(CsrTime *high)
32 ts = current_kernel_time();
33 time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
37 *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF);
40 low = (CsrTime) (time & 0xFFFFFFFF);
44 EXPORT_SYMBOL_GPL(CsrTimeGet);
46 void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high)
51 ts = current_kernel_time();
52 time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
56 *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF);
61 *low = (CsrTime) (time & 0xFFFFFFFF);
69 tod->msec = tv.tv_usec / 1000;