Read time zone information from registry at startup.

svn path=/trunk/; revision=11544
This commit is contained in:
Eric Kohl
2004-11-05 17:42:20 +00:00
parent 8655dad649
commit e339d82c69
5 changed files with 75 additions and 64 deletions
-1
View File
@@ -43,7 +43,6 @@ ExInit2(VOID)
VOID INIT_FUNCTION
ExInit3 (VOID)
{
ExInitTimeZoneInfo();
ExInitializeWorkerThreads();
ExpWin32kInit();
}
+25 -28
View File
@@ -1,4 +1,4 @@
/* $Id: sysinfo.c,v 1.55 2004/10/30 16:07:46 ion Exp $
/* $Id: sysinfo.c,v 1.56 2004/11/05 17:42:20 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -543,7 +543,7 @@ QSI_DEF(SystemTimeOfDayInformation)
Sti->BootTime= SystemBootTime;
Sti->CurrentTime = CurrentTime;
Sti->TimeZoneBias.QuadPart = _SystemTimeZoneInfo.Bias;
Sti->TimeZoneBias.QuadPart = 0; /* FIXME */
Sti->TimeZoneId = 0; /* FIXME */
Sti->Reserved = 0; /* FIXME */
@@ -1182,39 +1182,36 @@ QSI_DEF(SystemProcessorSpeedInformation)
/* Class 44 - Current Time Zone Information */
QSI_DEF(SystemCurrentTimeZoneInformation)
{
* ReqSize = sizeof (TIME_ZONE_INFORMATION);
* ReqSize = sizeof (TIME_ZONE_INFORMATION);
if (sizeof (TIME_ZONE_INFORMATION) != Size)
{
return (STATUS_INFO_LENGTH_MISMATCH);
}
/* Copy the time zone information struct */
memcpy (
Buffer,
& _SystemTimeZoneInfo,
sizeof (TIME_ZONE_INFORMATION)
);
if (sizeof (TIME_ZONE_INFORMATION) != Size)
{
return STATUS_INFO_LENGTH_MISMATCH;
}
return (STATUS_SUCCESS);
/* Copy the time zone information struct */
memcpy(Buffer,
&ExpTimeZoneInfo,
sizeof(TIME_ZONE_INFORMATION));
return STATUS_SUCCESS;
}
SSI_DEF(SystemCurrentTimeZoneInformation)
{
/*
* Check user buffer's size
*/
if (Size < sizeof (TIME_ZONE_INFORMATION))
{
return (STATUS_INFO_LENGTH_MISMATCH);
}
/* Copy the time zone information struct */
memcpy (
& _SystemTimeZoneInfo,
(TIME_ZONE_INFORMATION *) Buffer,
sizeof (TIME_ZONE_INFORMATION)
);
return (STATUS_SUCCESS);
/* Check user buffer's size */
if (Size < sizeof (TIME_ZONE_INFORMATION))
{
return STATUS_INFO_LENGTH_MISMATCH;
}
/* Copy the time zone information struct */
memcpy(&ExpTimeZoneInfo,
(TIME_ZONE_INFORMATION *)Buffer,
sizeof(TIME_ZONE_INFORMATION));
return STATUS_SUCCESS;
}
+39 -27
View File
@@ -1,4 +1,4 @@
/* $Id: time.c,v 1.22 2004/11/05 11:46:02 ekohl Exp $
/* $Id: time.c,v 1.23 2004/11/05 17:42:20 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -20,34 +20,38 @@
/* GLOBALS ******************************************************************/
/* Note: Bias[minutes] = UTC - local time */
TIME_ZONE_INFORMATION _SystemTimeZoneInfo;
TIME_ZONE_INFORMATION ExpTimeZoneInfo;
/* FUNCTIONS ****************************************************************/
VOID INIT_FUNCTION
ExInitTimeZoneInfo (VOID)
ExpInitTimeZoneInfo(VOID)
{
/* Initialize system time zone information */
memset (& _SystemTimeZoneInfo, 0, sizeof(TIME_ZONE_INFORMATION));
NTSTATUS Status;
/* FIXME: Read time zone information from the registry */
/* Read time zone information from the registry */
Status = RtlQueryTimeZoneInformation(&ExpTimeZoneInfo);
if (!NT_SUCCESS(Status))
{
memset(&ExpTimeZoneInfo, 0, sizeof(TIME_ZONE_INFORMATION));
}
}
/*
* FUNCTION: Sets the system time.
* PARAMETERS:
* NewTime - Points to a variable that specified the new time
* of day in the standard time format.
* OldTime - Optionally points to a variable that receives the
* old time of day in the standard time format.
* RETURNS: Status
*/
NTSTATUS STDCALL
NtSetSystemTime(IN PLARGE_INTEGER UnsafeNewSystemTime,
OUT PLARGE_INTEGER UnsafeOldSystemTime OPTIONAL)
/*
* FUNCTION: Sets the system time.
* PARAMETERS:
* NewTime - Points to a variable that specified the new time
* of day in the standard time format.
* OldTime - Optionally points to a variable that receives the
* old time of day in the standard time format.
* RETURNS: Status
*/
{
NTSTATUS Status;
LARGE_INTEGER OldSystemTime;
@@ -90,14 +94,14 @@ NtSetSystemTime(IN PLARGE_INTEGER UnsafeNewSystemTime,
}
/*
* FUNCTION: Retrieves the system time.
* PARAMETERS:
* CurrentTime - Points to a variable that receives the current
* time of day in the standard time format.
*/
NTSTATUS STDCALL
NtQuerySystemTime (OUT PLARGE_INTEGER UnsafeCurrentTime)
/*
* FUNCTION: Retrieves the system time.
* PARAMETERS:
* CurrentTime - Points to a variable that receives the current
* time of day in the standard time format.
*/
NtQuerySystemTime(OUT PLARGE_INTEGER UnsafeCurrentTime)
{
LARGE_INTEGER CurrentTime;
NTSTATUS Status;
@@ -119,14 +123,18 @@ NtQuerySystemTime (OUT PLARGE_INTEGER UnsafeCurrentTime)
VOID
STDCALL
ExLocalTimeToSystemTime (
PLARGE_INTEGER LocalTime,
PLARGE_INTEGER LocalTime,
PLARGE_INTEGER SystemTime
)
{
SystemTime->QuadPart = LocalTime->QuadPart +
_SystemTimeZoneInfo.Bias * TICKSPERMINUTE;
SystemTime->QuadPart = LocalTime->QuadPart;
#if 0
+
ExpTimeZoneInfo.Bias * TICKSPERMINUTE;
#endif
}
/*
* @unimplemented
*/
@@ -140,6 +148,7 @@ ExSetTimerResolution (
UNIMPLEMENTED;
}
/*
* @implemented
*/
@@ -150,8 +159,11 @@ ExSystemTimeToLocalTime (
PLARGE_INTEGER LocalTime
)
{
LocalTime->QuadPart = SystemTime->QuadPart -
_SystemTimeZoneInfo.Bias * TICKSPERMINUTE;
LocalTime->QuadPart = SystemTime->QuadPart;
#if 0
-
ExpTimeZoneInfo.Bias * TICKSPERMINUTE;
#endif
}
/* EOF */
+7 -7
View File
@@ -75,7 +75,7 @@ typedef VOID (*PLOOKASIDE_MINMAX_ROUTINE)(
/* GLOBAL VARIABLES *********************************************************/
TIME_ZONE_INFORMATION _SystemTimeZoneInfo;
TIME_ZONE_INFORMATION ExpTimeZoneInfo;
extern POBJECT_TYPE ExEventPairObjectType;
@@ -84,13 +84,13 @@ extern POBJECT_TYPE ExEventPairObjectType;
VOID
ExpWin32kInit(VOID);
VOID
ExInit2 (VOID);
VOID
ExInit3 (VOID);
VOID
ExInitTimeZoneInfo (VOID);
VOID
ExInit2(VOID);
VOID
ExInit3(VOID);
VOID
ExpInitTimeZoneInfo(VOID);
VOID
ExInitializeWorkerThreads(VOID);
VOID
ExpInitLookasideLists(VOID);
+4 -1
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: main.c,v 1.202 2004/10/24 15:26:14 weiden Exp $
/* $Id: main.c,v 1.203 2004/11/05 17:41:34 ekohl Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c
@@ -641,6 +641,9 @@ ExpInitializeExecutive(VOID)
CmInit2((PCHAR)KeLoaderBlock.CommandLine);
}
/* Initialize the time zone information from the registry */
ExpInitTimeZoneInfo();
/*
* Enter the kernel debugger before starting up the boot drivers
*/