Added more time functions
authorEric Kohl <eric.kohl@reactos.org>
Fri, 7 Apr 2000 12:45:22 +0000 (12:45 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Fri, 7 Apr 2000 12:45:22 +0000 (12:45 +0000)
svn path=/trunk/; revision=1109

reactos/include/ddk/zwtypes.h
reactos/include/ntdll/rtl.h
reactos/lib/ntdll/rtl/time.c

index 07ae07c..432ff63 100644 (file)
@@ -318,14 +318,14 @@ typedef struct _SYSTEM_PROCESS_INFORMATION
 } SYSTEM_PROCESS_INFORMATION, * PSYSTEM_PROCESS_INFORMATION;
 #endif
 
 } 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;
 {
        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
 {
 
 typedef struct _SYSTEM_GLOBAL_FLAGS_INFO
 {
index a5da858..7f035ae 100644 (file)
@@ -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
        );
 
        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 */
 #endif /* __INCLUDE_NTDLL_RTL_H */
 
 /* EOF */
index 031f0f6..e8866cc 100644 (file)
@@ -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
  * 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:
  * PURPOSE:         Conversion between Time and TimeFields
  * PROGRAMMER:      Rex Jolliff (rex@lvcablemodem.com)
  * UPDATE HISTORY:
@@ -12,6 +13,7 @@
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
 /* INCLUDES *****************************************************************/
 
 #include <ddk/ntddk.h>
+#include <ntdll/rtl.h>
 
 #include <internal/debug.h>
 
 
 #include <internal/debug.h>
 
@@ -266,4 +268,52 @@ RtlTimeToSecondsSince1980 (
    return TRUE;
 }
 
    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 */