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.
This commit is contained in:
Andrew Thompson 2007-12-02 08:54:50 +00:00
parent b640825647
commit e880149eb9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=174150
3 changed files with 8 additions and 13 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}