From 654c8e7d00f9047f97f973194c7fc46a0f7332ae Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 7 Apr 2000 12:45:22 +0000 Subject: [PATCH] Added more time functions svn path=/trunk/; revision=1109 --- reactos/include/ddk/zwtypes.h | 4 +-- reactos/include/ntdll/rtl.h | 16 +++++++++- reactos/lib/ntdll/rtl/time.c | 56 +++++++++++++++++++++++++++++++++-- 3 files changed, 70 insertions(+), 6 deletions(-) diff --git a/reactos/include/ddk/zwtypes.h b/reactos/include/ddk/zwtypes.h index 07ae07cab26..432ff63d675 100644 --- a/reactos/include/ddk/zwtypes.h +++ b/reactos/include/ddk/zwtypes.h @@ -318,14 +318,14 @@ typedef struct _SYSTEM_PROCESS_INFORMATION } SYSTEM_PROCESS_INFORMATION, * PSYSTEM_PROCESS_INFORMATION; #endif -typedef struct _SYSTEM_TIME_INFO +typedef struct _SYSTEM_TIME_INFORMATION { LARGE_INTEGER BootTime; LARGE_INTEGER SystemTime; LARGE_INTEGER TimeZoneBias; ULONG TimeZoneId; ULONG Unknown; -} SYSTEM_TIME_INFO, *PSYSTEM_TIME_INFO; +} SYSTEM_TIME_INFORMATION, *PSYSTEM_TIME_INFORMATION; typedef struct _SYSTEM_GLOBAL_FLAGS_INFO { diff --git a/reactos/include/ntdll/rtl.h b/reactos/include/ntdll/rtl.h index a5da8587872..7f035ae4f0d 100644 --- a/reactos/include/ntdll/rtl.h +++ b/reactos/include/ntdll/rtl.h @@ -1,4 +1,4 @@ -/* $Id: rtl.h,v 1.13 2000/03/09 15:59:50 ekohl Exp $ +/* $Id: rtl.h,v 1.14 2000/04/07 12:45:02 ekohl Exp $ * */ @@ -265,6 +265,20 @@ RtlNormalizeProcessParams ( IN OUT PRTL_USER_PROCESS_PARAMETERS ProcessParameters ); +NTSTATUS +STDCALL +RtlLocalTimeToSystemTime ( + PLARGE_INTEGER LocalTime, + PLARGE_INTEGER SystemTime + ); + +NTSTATUS +STDCALL +RtlSystemTimeToLocalTime ( + PLARGE_INTEGER SystemTime, + PLARGE_INTEGER LocalTime + ); + #endif /* __INCLUDE_NTDLL_RTL_H */ /* EOF */ diff --git a/reactos/lib/ntdll/rtl/time.c b/reactos/lib/ntdll/rtl/time.c index 031f0f6321f..e8866cc7c1e 100644 --- a/reactos/lib/ntdll/rtl/time.c +++ b/reactos/lib/ntdll/rtl/time.c @@ -1,7 +1,8 @@ -/* +/* $Id: time.c,v 1.5 2000/04/07 12:45:22 ekohl Exp $ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: kernel/rtl/time.c + * FILE: lib/ntdll/rtl/time.c * PURPOSE: Conversion between Time and TimeFields * PROGRAMMER: Rex Jolliff (rex@lvcablemodem.com) * UPDATE HISTORY: @@ -12,6 +13,7 @@ /* INCLUDES *****************************************************************/ #include +#include #include @@ -266,4 +268,52 @@ RtlTimeToSecondsSince1980 ( return TRUE; } -/* EOF */ \ No newline at end of file + +NTSTATUS +STDCALL +RtlLocalTimeToSystemTime ( + PLARGE_INTEGER LocalTime, + PLARGE_INTEGER SystemTime + ) +{ + SYSTEM_TIME_INFORMATION TimeInformation; + NTSTATUS Status; + + Status = NtQuerySystemInformation (SystemTimeInformation, + &TimeInformation, + sizeof(SYSTEM_TIME_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + return Status; + + SystemTime->QuadPart = LocalTime->QuadPart + + TimeInformation.TimeZoneBias.QuadPart; + + return STATUS_SUCCESS; +} + + +NTSTATUS +STDCALL +RtlSystemTimeToLocalTime ( + PLARGE_INTEGER SystemTime, + PLARGE_INTEGER LocalTime + ) +{ + SYSTEM_TIME_INFORMATION TimeInformation; + NTSTATUS Status; + + Status = NtQuerySystemInformation (SystemTimeInformation, + &TimeInformation, + sizeof(SYSTEM_TIME_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + return Status; + + LocalTime->QuadPart = SystemTime->QuadPart - + TimeInformation.TimeZoneBias.QuadPart; + + return STATUS_SUCCESS; +} + +/* EOF */ -- 2.17.1