]> git.proxmox.com Git - mirror_spl-debian.git/blame - modules/spl/spl-time.c
Prep for for 0.3.0 tag, this is the tag which was used for all
[mirror_spl-debian.git] / modules / spl / spl-time.c
CommitLineData
ee476682 1#include <sys/sysmacros.h>
2#include <sys/time.h>
3#include "config.h"
4
937879f1 5#ifdef DEBUG_SUBSYSTEM
6#undef DEBUG_SUBSYSTEM
7#endif
8
9#define DEBUG_SUBSYSTEM S_TIME
10
ee476682 11void
12__gethrestime(timestruc_t *ts)
13{
14 getnstimeofday((struct timespec *)ts);
15}
ee476682 16EXPORT_SYMBOL(__gethrestime);
79b31f36 17
18int
19__clock_gettime(clock_type_t type, timespec_t *tp)
20{
21 /* Only support CLOCK_REALTIME+__CLOCK_REALTIME0 for now */
937879f1 22 ASSERT((type == CLOCK_REALTIME) || (type == __CLOCK_REALTIME0));
79b31f36 23
24 getnstimeofday(tp);
25 return 0;
26}
27EXPORT_SYMBOL(__clock_gettime);
28
29/* This function may not be as fast as using monotonic_clock() but it
30 * should be much more portable, if performance becomes as issue we can
31 * look at using monotonic_clock() for x86_64 and x86 arches.
32 */
33hrtime_t
34__gethrtime(void) {
35 timespec_t tv;
36 hrtime_t rc;
37
38 do_posix_clock_monotonic_gettime(&tv);
39 rc = (NSEC_PER_SEC * (hrtime_t)tv.tv_sec) + (hrtime_t)tv.tv_nsec;
40
41 return rc;
42}
43EXPORT_SYMBOL(__gethrtime);