mirror of
https://github.com/reactos/reactos.git
synced 2025-04-30 02:58:48 +00:00
Set system time and update boot time and relative timers.
svn path=/trunk/; revision=11850
This commit is contained in:
parent
e8e894de92
commit
d899ea5ca7
3 changed files with 65 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: time.c,v 1.24 2004/11/06 16:04:58 ekohl Exp $
|
/* $Id: time.c,v 1.25 2004/11/28 12:59:33 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -89,7 +89,7 @@ NtSetSystemTime(IN PLARGE_INTEGER UnsafeNewSystemTime,
|
||||||
sizeof(NewSystemTime));
|
sizeof(NewSystemTime));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UnsafeOldSystemTime != NULL)
|
if (UnsafeOldSystemTime != NULL)
|
||||||
|
@ -102,10 +102,8 @@ NtSetSystemTime(IN PLARGE_INTEGER UnsafeNewSystemTime,
|
||||||
&TimeFields);
|
&TimeFields);
|
||||||
HalSetRealTimeClock(&TimeFields);
|
HalSetRealTimeClock(&TimeFields);
|
||||||
|
|
||||||
/* FIXME: set system time */
|
/* Set system time */
|
||||||
#if 0
|
KiSetSystemTime(&NewSystemTime);
|
||||||
KeSetSystemTime();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (UnsafeOldSystemTime != NULL)
|
if (UnsafeOldSystemTime != NULL)
|
||||||
{
|
{
|
||||||
|
@ -113,10 +111,11 @@ NtSetSystemTime(IN PLARGE_INTEGER UnsafeNewSystemTime,
|
||||||
sizeof(OldSystemTime));
|
sizeof(OldSystemTime));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,9 @@ VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
KeFlushCurrentTb(VOID);
|
KeFlushCurrentTb(VOID);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KiSetSystemTime(PLARGE_INTEGER NewSystemTime);
|
||||||
|
|
||||||
#endif /* not __ASM__ */
|
#endif /* not __ASM__ */
|
||||||
|
|
||||||
#define MAXIMUM_PROCESSORS 32
|
#define MAXIMUM_PROCESSORS 32
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: timer.c,v 1.91 2004/11/27 16:57:03 hbirr Exp $
|
/* $Id: timer.c,v 1.92 2004/11/28 12:59:00 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -821,4 +821,58 @@ KeUpdateSystemTime(
|
||||||
KeInsertQueueDpc(&ExpireTimerDpc, (PVOID)TrapFrame->Eip, 0);
|
KeInsertQueueDpc(&ExpireTimerDpc, (PVOID)TrapFrame->Eip, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KiSetSystemTime(PLARGE_INTEGER NewSystemTime)
|
||||||
|
{
|
||||||
|
LARGE_INTEGER OldSystemTime;
|
||||||
|
LARGE_INTEGER DeltaTime;
|
||||||
|
KIRQL OldIrql;
|
||||||
|
PLIST_ENTRY current_entry = NULL;
|
||||||
|
PKTIMER current = NULL;
|
||||||
|
|
||||||
|
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
|
||||||
|
|
||||||
|
OldIrql = KeAcquireDispatcherDatabaseLock();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
OldSystemTime.u.HighPart = SharedUserData->SystemTime.High1Time;
|
||||||
|
OldSystemTime.u.LowPart = SharedUserData->SystemTime.LowPart;
|
||||||
|
}
|
||||||
|
while (OldSystemTime.u.HighPart != SharedUserData->SystemTime.High2Time);
|
||||||
|
|
||||||
|
/* Set the new system time */
|
||||||
|
SharedUserData->SystemTime.LowPart = NewSystemTime->u.LowPart;
|
||||||
|
SharedUserData->SystemTime.High1Time = NewSystemTime->u.HighPart;
|
||||||
|
SharedUserData->SystemTime.High2Time = NewSystemTime->u.HighPart;
|
||||||
|
|
||||||
|
/* Calculate the difference between the new and the old time */
|
||||||
|
DeltaTime.QuadPart = NewSystemTime->QuadPart - OldSystemTime.QuadPart;
|
||||||
|
|
||||||
|
/* Update system boot time */
|
||||||
|
SystemBootTime.QuadPart += DeltaTime.QuadPart;
|
||||||
|
|
||||||
|
/* Update all relative timers */
|
||||||
|
current_entry = RelativeTimerListHead.Flink;
|
||||||
|
ASSERT(current_entry);
|
||||||
|
while (current_entry != &RelativeTimerListHead)
|
||||||
|
{
|
||||||
|
current = CONTAINING_RECORD(current_entry, KTIMER, TimerListEntry);
|
||||||
|
ASSERT(current);
|
||||||
|
ASSERT(current_entry != &RelativeTimerListHead);
|
||||||
|
ASSERT(current_entry->Flink != current_entry);
|
||||||
|
|
||||||
|
current->DueTime.QuadPart += DeltaTime.QuadPart;
|
||||||
|
|
||||||
|
current_entry = current_entry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeReleaseDispatcherDatabaseLock(OldIrql);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: Expired timers will be processed at the next clock tick!
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue