Partially implemented (handlers only)
[reactos.git] / reactos / ntoskrnl / ex / time.c
1 /* $Id: time.c,v 1.9 2000/04/25 23:22:56 ea Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: kernel/excutive/time.c
6 * PURPOSE: Time
7 * PROGRAMMER: David Welch (welch@mcmail.com)
8 * UPDATE HISTORY:
9 * Created 22/05/98
10 */
11
12 /* INCLUDES *****************************************************************/
13
14 #include <ddk/ntddk.h>
15 #include <internal/ex.h>
16 #include <string.h>
17
18 #include <internal/debug.h>
19
20
21 #define TICKSPERMINUTE 600000000
22
23 /* GLOBALS ******************************************************************/
24
25 /* Note: Bias[minutes] = UTC - local time */
26 TIME_ZONE_INFORMATION _SystemTimeZoneInfo;
27
28
29 /* FUNCTIONS ****************************************************************/
30
31 VOID
32 ExInitTimeZoneInfo (VOID)
33 {
34 /* Initialize system time zone information */
35 memset (& _SystemTimeZoneInfo, 0, sizeof(TIME_ZONE_INFORMATION));
36
37 /* FIXME: Read time zone information from the registry */
38
39 }
40
41
42 NTSTATUS
43 STDCALL
44 NtSetSystemTime (
45 IN PLARGE_INTEGER SystemTime,
46 IN PLARGE_INTEGER NewSystemTime OPTIONAL
47 )
48 {
49 // HalSetRealTimeClock ((PTIME)SystemTime);
50 // UNIMPLEMENTED;
51 return STATUS_SUCCESS;
52 }
53
54
55 NTSTATUS
56 STDCALL
57 NtQuerySystemTime (
58 OUT TIME * CurrentTime
59 )
60 {
61 KeQuerySystemTime((PLARGE_INTEGER)CurrentTime);
62 return STATUS_SUCCESS;
63 }
64
65
66 VOID
67 ExLocalTimeToSystemTime (
68 PLARGE_INTEGER LocalTime,
69 PLARGE_INTEGER SystemTime
70 )
71 {
72 SystemTime->QuadPart = LocalTime->QuadPart +
73 _SystemTimeZoneInfo.Bias * TICKSPERMINUTE;
74 }
75
76
77 VOID
78 ExSystemTimeToLocalTime (
79 PLARGE_INTEGER SystemTime,
80 PLARGE_INTEGER LocalTime
81 )
82 {
83 LocalTime->QuadPart = SystemTime->QuadPart -
84 _SystemTimeZoneInfo.Bias * TICKSPERMINUTE;
85 }
86
87 /* EOF */