mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 17:01:53 +00:00
Improved time functions.
svn path=/trunk/; revision=462
This commit is contained in:
parent
e1e75da515
commit
9bdf8fd314
3 changed files with 36 additions and 6 deletions
|
@ -14,7 +14,14 @@
|
|||
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
#define TICKSPERMINUTE 600000000
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
static LONG lTimeZoneBias = 0; /* bias[minutes] = UTC - local time */
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS STDCALL NtSetSystemTime(IN PLARGE_INTEGER SystemTime,
|
||||
IN PLARGE_INTEGER NewSystemTime OPTIONAL)
|
||||
|
@ -35,17 +42,21 @@ NTSTATUS STDCALL NtQuerySystemTime (OUT TIME *CurrentTime)
|
|||
|
||||
NTSTATUS STDCALL ZwQuerySystemTime (OUT TIME *CurrentTime)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
KeQuerySystemTime((PLARGE_INTEGER)CurrentTime);
|
||||
return STATUS_SUCCESS;
|
||||
// UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID ExLocalTimeToSystemTime(PLARGE_INTEGER LocalTime,
|
||||
PLARGE_INTEGER SystemTime)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
SystemTime->QuadPart = LocalTime->QuadPart +
|
||||
lTimeZoneBias * TICKSPERMINUTE;
|
||||
}
|
||||
|
||||
VOID ExSystemTimeToLocalTime(PLARGE_INTEGER SystemTime,
|
||||
PLARGE_INTEGER LocalTime)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
LocalTime->QuadPart = SystemTime->QuadPart -
|
||||
lTimeZoneBias * TICKSPERMINUTE;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,10 @@ void HalQueryRealTimeClock(PTIME_FIELDS pTime)
|
|||
pTime->Year=BCD_INT(inb_p(0x71));
|
||||
if(pTime->Year>80) pTime->Year +=1900;
|
||||
else pTime->Year +=2000;
|
||||
//FIXME pTime->MilliSeconds=
|
||||
pTime->Milliseconds=0;
|
||||
}
|
||||
|
||||
|
||||
void HalSetRealTimeClock(PTIME_FIELDS pTime)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ extern inline unsigned int linear_to_physical(unsigned int x)
|
|||
/*
|
||||
* Current time
|
||||
*/
|
||||
static unsigned long long boot_time = 0;
|
||||
static unsigned long long system_time = 0;
|
||||
|
||||
/*
|
||||
|
@ -571,10 +572,24 @@ VOID KeInitializeTimerImpl(VOID)
|
|||
* NOTE: This is only called once from main()
|
||||
*/
|
||||
{
|
||||
TIME_FIELDS TimeFields;
|
||||
LARGE_INTEGER SystemBootTime;
|
||||
|
||||
InitializeListHead(&timer_list_head);
|
||||
KeInitializeSpinLock(&timer_list_lock);
|
||||
|
||||
/*
|
||||
* Calculate the starting time for the system clock
|
||||
*/
|
||||
HalQueryRealTimeClock(&TimeFields);
|
||||
DbgPrint("Date: %d.%d.%d\nTime: %d:%d:%d\n",
|
||||
TimeFields.Day,
|
||||
TimeFields.Month,
|
||||
TimeFields.Year,
|
||||
TimeFields.Hour,
|
||||
TimeFields.Minute,
|
||||
TimeFields.Second);
|
||||
RtlTimeFieldsToTime(&TimeFields, &SystemBootTime);
|
||||
boot_time=SystemBootTime.QuadPart;
|
||||
system_time=boot_time;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue