mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 13:38:19 +00:00
Implemented RtlTimeToElapsedTimeFields().
svn path=/trunk/; revision=3303
This commit is contained in:
parent
873c86599e
commit
554d0a03f4
3 changed files with 81 additions and 47 deletions
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntdll.def,v 1.83 2002/06/05 16:51:20 ekohl Exp $
|
; $Id: ntdll.def,v 1.84 2002/07/25 16:58:58 ekohl Exp $
|
||||||
;
|
;
|
||||||
; ReactOS Operating System
|
; ReactOS Operating System
|
||||||
;
|
;
|
||||||
|
@ -557,7 +557,7 @@ RtlSubAuthoritySid@8
|
||||||
;RtlSubtreeSuccessor
|
;RtlSubtreeSuccessor
|
||||||
RtlSystemTimeToLocalTime@8
|
RtlSystemTimeToLocalTime@8
|
||||||
RtlTimeFieldsToTime@8
|
RtlTimeFieldsToTime@8
|
||||||
;RtlTimeToElapsedTimeFields
|
RtlTimeToElapsedTimeFields@8
|
||||||
RtlTimeToSecondsSince1970@8
|
RtlTimeToSecondsSince1970@8
|
||||||
RtlTimeToSecondsSince1980@8
|
RtlTimeToSecondsSince1980@8
|
||||||
RtlTimeToTimeFields@8
|
RtlTimeToTimeFields@8
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntdll.edf,v 1.72 2002/06/05 16:51:20 ekohl Exp $
|
; $Id: ntdll.edf,v 1.73 2002/07/25 16:58:58 ekohl Exp $
|
||||||
;
|
;
|
||||||
; ReactOS Operating System
|
; ReactOS Operating System
|
||||||
;
|
;
|
||||||
|
@ -556,7 +556,7 @@ RtlSubAuthoritySid=RtlSubAuthoritySid@8
|
||||||
;RtlSubtreeSuccessor
|
;RtlSubtreeSuccessor
|
||||||
RtlSystemTimeToLocalTime=RtlSystemTimeToLocalTime@8
|
RtlSystemTimeToLocalTime=RtlSystemTimeToLocalTime@8
|
||||||
RtlTimeFieldsToTime=RtlTimeFieldsToTime@8
|
RtlTimeFieldsToTime=RtlTimeFieldsToTime@8
|
||||||
;RtlTimeToElapsedTimeFields
|
RtlTimeToElapsedTimeFields=RtlTimeToElapsedTimeFields@8
|
||||||
RtlTimeToSecondsSince1970=RtlTimeToSecondsSince1970@8
|
RtlTimeToSecondsSince1970=RtlTimeToSecondsSince1970@8
|
||||||
RtlTimeToSecondsSince1980=RtlTimeToSecondsSince1980@8
|
RtlTimeToSecondsSince1980=RtlTimeToSecondsSince1980@8
|
||||||
RtlTimeToTimeFields=RtlTimeToTimeFields@8
|
RtlTimeToTimeFields=RtlTimeToTimeFields@8
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: time.c,v 1.9 2001/06/22 12:36:23 ekohl Exp $
|
/* $Id: time.c,v 1.10 2002/07/25 16:58:35 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -55,6 +55,40 @@ static __inline void NormalizeTimeFields(CSHORT *FieldToNormalize,
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
VOID STDCALL
|
||||||
|
RtlTimeToElapsedTimeFields(IN PLARGE_INTEGER Time,
|
||||||
|
OUT PTIME_FIELDS TimeFields)
|
||||||
|
{
|
||||||
|
ULONGLONG ElapsedSeconds;
|
||||||
|
ULONG SecondsInDay;
|
||||||
|
ULONG SecondsInMinute;
|
||||||
|
|
||||||
|
/* Extract millisecond from time */
|
||||||
|
TimeFields->Milliseconds = (CSHORT)((Time->QuadPart % TICKSPERSEC) / TICKSPERMSEC);
|
||||||
|
|
||||||
|
/* Compute elapsed seconds */
|
||||||
|
ElapsedSeconds = (ULONGLONG)Time->QuadPart / TICKSPERSEC;
|
||||||
|
|
||||||
|
/* Compute seconds within the day */
|
||||||
|
SecondsInDay = ElapsedSeconds % SECSPERDAY;
|
||||||
|
|
||||||
|
/* Compute elapsed minutes within the day */
|
||||||
|
SecondsInMinute = SecondsInDay % SECSPERHOUR;
|
||||||
|
|
||||||
|
/* Compute elapsed time of day */
|
||||||
|
TimeFields->Hour = (CSHORT)(SecondsInDay / SECSPERHOUR);
|
||||||
|
TimeFields->Minute = (CSHORT)(SecondsInMinute / SECSPERMIN);
|
||||||
|
TimeFields->Second = (CSHORT)(SecondsInMinute % SECSPERMIN);
|
||||||
|
|
||||||
|
/* Compute elapsed days */
|
||||||
|
TimeFields->Day = (CSHORT)(ElapsedSeconds / SECSPERDAY);
|
||||||
|
|
||||||
|
/* The elapsed number of months and days cannot be calculated */
|
||||||
|
TimeFields->Month = 0;
|
||||||
|
TimeFields->Year = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
RtlTimeToTimeFields(PLARGE_INTEGER liTime,
|
RtlTimeToTimeFields(PLARGE_INTEGER liTime,
|
||||||
PTIME_FIELDS TimeFields)
|
PTIME_FIELDS TimeFields)
|
||||||
|
@ -225,11 +259,11 @@ RtlTimeToSecondsSince1970(PLARGE_INTEGER Time,
|
||||||
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
|
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
|
||||||
|
|
||||||
if (liTime.u.HighPart != 0)
|
if (liTime.u.HighPart != 0)
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
|
|
||||||
*SecondsSince1970 = liTime.u.LowPart;
|
*SecondsSince1970 = liTime.u.LowPart;
|
||||||
|
|
||||||
return TRUE;
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,11 +277,11 @@ RtlTimeToSecondsSince1980(PLARGE_INTEGER Time,
|
||||||
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
|
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
|
||||||
|
|
||||||
if (liTime.u.HighPart != 0)
|
if (liTime.u.HighPart != 0)
|
||||||
return FALSE;
|
return(FALSE);
|
||||||
|
|
||||||
*SecondsSince1980 = liTime.u.LowPart;
|
*SecondsSince1980 = liTime.u.LowPart;
|
||||||
|
|
||||||
return TRUE;
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,17 +292,17 @@ RtlLocalTimeToSystemTime(PLARGE_INTEGER LocalTime,
|
||||||
SYSTEM_TIMEOFDAY_INFORMATION TimeInformation;
|
SYSTEM_TIMEOFDAY_INFORMATION TimeInformation;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = NtQuerySystemInformation (SystemTimeOfDayInformation,
|
Status = NtQuerySystemInformation(SystemTimeOfDayInformation,
|
||||||
&TimeInformation,
|
&TimeInformation,
|
||||||
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return(Status);
|
||||||
|
|
||||||
SystemTime->QuadPart = LocalTime->QuadPart +
|
SystemTime->QuadPart = LocalTime->QuadPart +
|
||||||
TimeInformation.TimeZoneBias.QuadPart;
|
TimeInformation.TimeZoneBias.QuadPart;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,17 +313,17 @@ RtlSystemTimeToLocalTime(PLARGE_INTEGER SystemTime,
|
||||||
SYSTEM_TIMEOFDAY_INFORMATION TimeInformation;
|
SYSTEM_TIMEOFDAY_INFORMATION TimeInformation;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = NtQuerySystemInformation (SystemTimeOfDayInformation,
|
Status = NtQuerySystemInformation(SystemTimeOfDayInformation,
|
||||||
&TimeInformation,
|
&TimeInformation,
|
||||||
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return(Status);
|
||||||
|
|
||||||
LocalTime->QuadPart = SystemTime->QuadPart -
|
LocalTime->QuadPart = SystemTime->QuadPart -
|
||||||
TimeInformation.TimeZoneBias.QuadPart;
|
TimeInformation.TimeZoneBias.QuadPart;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue