mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 20:18:22 +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
|
||||
;
|
||||
|
@ -557,7 +557,7 @@ RtlSubAuthoritySid@8
|
|||
;RtlSubtreeSuccessor
|
||||
RtlSystemTimeToLocalTime@8
|
||||
RtlTimeFieldsToTime@8
|
||||
;RtlTimeToElapsedTimeFields
|
||||
RtlTimeToElapsedTimeFields@8
|
||||
RtlTimeToSecondsSince1970@8
|
||||
RtlTimeToSecondsSince1980@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
|
||||
;
|
||||
|
@ -556,7 +556,7 @@ RtlSubAuthoritySid=RtlSubAuthoritySid@8
|
|||
;RtlSubtreeSuccessor
|
||||
RtlSystemTimeToLocalTime=RtlSystemTimeToLocalTime@8
|
||||
RtlTimeFieldsToTime=RtlTimeFieldsToTime@8
|
||||
;RtlTimeToElapsedTimeFields
|
||||
RtlTimeToElapsedTimeFields=RtlTimeToElapsedTimeFields@8
|
||||
RtlTimeToSecondsSince1970=RtlTimeToSecondsSince1970@8
|
||||
RtlTimeToSecondsSince1980=RtlTimeToSecondsSince1980@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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -55,6 +55,40 @@ static __inline void NormalizeTimeFields(CSHORT *FieldToNormalize,
|
|||
|
||||
/* 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
|
||||
RtlTimeToTimeFields(PLARGE_INTEGER liTime,
|
||||
PTIME_FIELDS TimeFields)
|
||||
|
@ -225,11 +259,11 @@ RtlTimeToSecondsSince1970(PLARGE_INTEGER Time,
|
|||
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
|
||||
|
||||
if (liTime.u.HighPart != 0)
|
||||
return FALSE;
|
||||
return(FALSE);
|
||||
|
||||
*SecondsSince1970 = liTime.u.LowPart;
|
||||
|
||||
return TRUE;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -243,11 +277,11 @@ RtlTimeToSecondsSince1980(PLARGE_INTEGER Time,
|
|||
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
|
||||
|
||||
if (liTime.u.HighPart != 0)
|
||||
return FALSE;
|
||||
return(FALSE);
|
||||
|
||||
*SecondsSince1980 = liTime.u.LowPart;
|
||||
|
||||
return TRUE;
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,12 +297,12 @@ RtlLocalTimeToSystemTime(PLARGE_INTEGER LocalTime,
|
|||
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
return(Status);
|
||||
|
||||
SystemTime->QuadPart = LocalTime->QuadPart +
|
||||
TimeInformation.TimeZoneBias.QuadPart;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -284,12 +318,12 @@ RtlSystemTimeToLocalTime(PLARGE_INTEGER SystemTime,
|
|||
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
return(Status);
|
||||
|
||||
LocalTime->QuadPart = SystemTime->QuadPart -
|
||||
TimeInformation.TimeZoneBias.QuadPart;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue