summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2007-12-02 08:54:50 +0000
committerthompsa <thompsa@FreeBSD.org>2007-12-02 08:54:50 +0000
commit200d23553e98c71f31c241b13845cb1f9658402b (patch)
treecc54d29d98cfd8d3ff8b116f789b605b15354485 /sys/compat
parentcf47268b027782c09dde44d0c1d11f745193ff4f (diff)
downloadFreeBSD-src-200d23553e98c71f31c241b13845cb1f9658402b.zip
FreeBSD-src-200d23553e98c71f31c241b13845cb1f9658402b.tar.gz
Correct the calculation for the number of 100ns intervals since
January 1, 1601. The 1601 - 1970 period was in seconds rather than 100ns units. Remove duplication by having NdisGetCurrentSystemTime call ntoskrnl_time.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/ndis/ntoskrnl_var.h1
-rw-r--r--sys/compat/ndis/subr_ndis.c11
-rw-r--r--sys/compat/ndis/subr_ntoskrnl.c9
3 files changed, 8 insertions, 13 deletions
diff --git a/sys/compat/ndis/ntoskrnl_var.h b/sys/compat/ndis/ntoskrnl_var.h
index 751f6aa..9eba736 100644
--- a/sys/compat/ndis/ntoskrnl_var.h
+++ b/sys/compat/ndis/ntoskrnl_var.h
@@ -1309,6 +1309,7 @@ extern int ntoskrnl_libinit(void);
extern int ntoskrnl_libfini(void);
extern void ntoskrnl_intr(void *);
+extern void ntoskrnl_time(uint64_t *);
extern uint16_t ExQueryDepthSList(slist_header *);
extern slist_entry
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c
index 02b034a..8d3dfd9 100644
--- a/sys/compat/ndis/subr_ndis.c
+++ b/sys/compat/ndis/subr_ndis.c
@@ -2661,20 +2661,11 @@ NdisMSynchronizeWithInterrupt(intr, syncfunc, syncctx)
return(KeSynchronizeExecution(intr->ni_introbj, syncfunc, syncctx));
}
-/*
- * Return the number of 100 nanosecond intervals since
- * January 1, 1601. (?!?!)
- */
static void
NdisGetCurrentSystemTime(tval)
uint64_t *tval;
{
- struct timespec ts;
-
- nanotime(&ts);
- *tval = (uint64_t)ts.tv_nsec / 100 + (uint64_t)ts.tv_sec * 10000000 +
- 11644473600;
-
+ ntoskrnl_time(tval);
return;
}
diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c
index b0fda80..0be598d 100644
--- a/sys/compat/ndis/subr_ntoskrnl.c
+++ b/sys/compat/ndis/subr_ntoskrnl.c
@@ -218,7 +218,6 @@ static int atoi (const char *);
static long atol (const char *);
static int rand(void);
static void srand(unsigned int);
-static void ntoskrnl_time(uint64_t *);
static uint8_t IoIsWdmVersionAvailable(uint8_t, uint8_t);
static void ntoskrnl_thrfunc(void *);
static ndis_status PsCreateSystemThread(ndis_handle *,
@@ -1574,7 +1573,11 @@ ntoskrnl_waittest(obj, increment)
return;
}
-static void
+/*
+ * Return the number of 100 nanosecond intervals since
+ * January 1, 1601. (?!?!)
+ */
+void
ntoskrnl_time(tval)
uint64_t *tval;
{
@@ -1582,7 +1585,7 @@ ntoskrnl_time(tval)
nanotime(&ts);
*tval = (uint64_t)ts.tv_nsec / 100 + (uint64_t)ts.tv_sec * 10000000 +
- 11644473600;
+ 11644473600 * 10000000; /* 100ns ticks from 1601 to 1970 */
return;
}
OpenPOWER on IntegriCloud