Added time related functions

svn path=/trunk/; revision=1041
This commit is contained in:
Eric Kohl 2000-03-09 16:01:25 +00:00
parent 89871935c1
commit bf4806c502
5 changed files with 132 additions and 22 deletions

View file

@ -1,4 +1,4 @@
/* $Id: rtl.h,v 1.12 2000/02/27 02:01:24 ekohl Exp $
/* $Id: rtl.h,v 1.13 2000/03/09 15:59:50 ekohl Exp $
*
*/
@ -28,11 +28,35 @@ typedef struct _RTL_USER_PROCESS_INFO
#define HEAP_BASE (0xa0000000)
VOID RtlDeleteCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
VOID RtlEnterCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
VOID RtlInitializeCriticalSection (LPCRITICAL_SECTION pcritical);
VOID RtlLeaveCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
WINBOOL RtlTryEntryCriticalSection (LPCRITICAL_SECTION lpCriticalSection);
VOID
STDCALL
RtlDeleteCriticalSection (
LPCRITICAL_SECTION lpCriticalSection
);
VOID
STDCALL
RtlEnterCriticalSection (
LPCRITICAL_SECTION lpCriticalSection
);
VOID
STDCALL
RtlInitializeCriticalSection (
LPCRITICAL_SECTION pcritical
);
VOID
STDCALL
RtlLeaveCriticalSection (
LPCRITICAL_SECTION lpCriticalSection
);
BOOLEAN
STDCALL
RtlTryEntryCriticalSection (
LPCRITICAL_SECTION lpCriticalSection
);
UINT
STDCALL

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.44 2000/03/09 00:13:37 ekohl Exp $
; $Id: ntdll.def,v 1.45 2000/03/09 16:01:24 ekohl Exp $
;
; ReactOS Operating System
;
@ -239,7 +239,7 @@ RtlAcquirePebLock@0
;RtlAtomToAtomTable
;RtlAddAttributeActionToRXact
;RtlAddAuditAccessToAce
;RtlAccCompoundAce
;RtlAddCompoundAce
;RtlAdjustPrivilege
;RtlAllocateAndInitializeSid
;RtlAllocateHandle
@ -308,7 +308,7 @@ RtlDeNormalizeProcessParams@4
;RtlDelete
;RtlDeleteAce
;RtlDeleteAtomFromAtomTable
;RtlDeleteCriticalSection
RtlDeleteCriticalSection@4
;RtlDeleteElementGenericTable
;RtlDeleteNoSplay
;RtlDeleteRegistryValue
@ -330,7 +330,7 @@ RtlDowncaseUnicodeString@12
RtlEnlargedIntegerMultiply@8
RtlEnlargedUnsignedDivide@16
RtlEnlargedUnsignedMultiply@8
;RtlEnterCriticalSection
RtlEnterCriticalSection@4
;RtlEnumProcessHeaps
;RtlEnumerateGenericTable
;RtlEnumerateGenericTableWithoutSplaying
@ -401,7 +401,7 @@ RtlInitUnicodeString@8
;RtlInitializeAtomPackage
RtlInitializeBitMap@12
RtlInitializeContext@20
;RtlInitializeCriticalSection
RtlInitializeCriticalSection@4
;RtlInitializeGenericTable
;RtlInitializeHandleTable
;RtlInitializeRXact
@ -424,7 +424,7 @@ RtlLargeIntegerShiftLeft@12
RtlLargeIntegerShiftRight@12
RtlLargeIntegerSubtract@16
;RtlLargeIntegerToChar
;RtlLeaveCriticalSection
RtlLeaveCriticalSection@4
;RtlLengthRequiredSid
RtlLengthSecurityDescriptor@4
;RtlLengthSid
@ -482,8 +482,8 @@ RtlReleasePebLock@0
;RtlResetRtlTranslations
;RtlRunDecodeUnicodeString
;RtlRunEncodeUnicodeString
;RtlSecondsSince1970ToTime
;RtlSecondsSince1980ToTime
RtlSecondsSince1970ToTime@8
RtlSecondsSince1980ToTime@8
;RtlSelfRelatedToAbsoluteSD
RtlSetAllBits@4
;RtlSetAttributesSecurityDescriptor
@ -512,12 +512,12 @@ RtlSizeHeap@12
;RtlSubtreePredecessor
;RtlSubtreeSuccessor
;RtlSystemTimeToLocalTime
;RtlTimeFieldsToTime
RtlTimeFieldsToTime@8
;RtlTimeToElapsedTimeFields
;RtlTimeToSecondsSince1970
;RtlTimeToSecondsSince1980
;RtlTimeToTimeFields
;RtlTryEnterCriticalSection
RtlTimeToSecondsSince1970@8
RtlTimeToSecondsSince1980@8
RtlTimeToTimeFields@8
RtlTryEnterCriticalSection@4
RtlUnicodeStringToAnsiSize@4
RtlUnicodeStringToAnsiString@12
RtlUnicodeStringToCountedOemString@12

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.33 2000/03/09 00:13:37 ekohl Exp $
; $Id: ntdll.edf,v 1.34 2000/03/09 16:01:25 ekohl Exp $
;
; ReactOS Operating System
;
@ -254,6 +254,7 @@ RtlCreateUnicodeStringFromAsciiz=RtlCreateUnicodeStringFromAsciiz@8
RtlCreateUserProcess=RtlCreateUserProcess@40
RtlCreateUserThread=RtlCreateUserThread@40
RtlDeNormalizeProcessParams=RtlDeNormalizeProcessParams@4
RtlDeleteCriticalSection=RtlDeleteCriticalSection@4
RtlDestroyEnvironment=RtlDestroyEnvironment@4
RtlDestroyHeap=RtlDestroyHeap@4
RtlDestroyProcessParameters=RtlDestroyProcessParameters@4
@ -265,6 +266,7 @@ RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
RtlEnlargedIntegerMultiply=RtlEnlargedIntegerMultiply@8
RtlEnlargedUnsignedDivide=RtlEnlargedUnsignedDivide@16
RtlEnlargedUnsignedMultiply=RtlEnlargedUnsignedMultiply@8
RtlEnterCriticalSection=RtlEnterCriticalSection@4
RtlEqualString=RtlEqualString@12
RtlEqualUnicodeString=RtlEqualUnicodeString@12
RtlEraseUnicodeString=RtlEraseUnicodeString@4
@ -295,6 +297,7 @@ RtlInitString=RtlInitString@8
RtlInitUnicodeString=RtlInitUnicodeString@8
RtlInitializeBitMap=RtlInitializeBitMap@12
RtlInitializeContext=RtlInitializeContext@20
RtlInitializeCriticalSection=RtlInitializeCriticalSection@4
RtlIntegerToChar=RtlIntegerToChar@16
RtlIntegerToUnicodeString=RtlIntegerToUnicodeString@12
RtlIsDosDeviceName_U=RtlIsDosDeviceName_U@4
@ -306,6 +309,7 @@ RtlLargeIntegerNegate=RtlLargeIntegerNegate@8
RtlLargeIntegerShiftLeft=RtlLargeIntegerShiftLeft@12
RtlLargeIntegerShiftRight=RtlLargeIntegerShiftRight@12
RtlLargeIntegerSubtract=RtlLargeIntegerSubtract@16
RtlLeaveCriticalSection=RtlLeaveCriticalSection@4
RtlLengthSecurityDescriptor=RtlLengthSecurityDescriptor@4
RtlLockHeap=RtlLockHeap@4
RtlMoveMemory=RtlMoveMemory@12
@ -322,6 +326,8 @@ RtlOemToUnicodeN=RtlOemToUnicodeN@20
RtlQueryEnvironmentVariable_U=RtlQueryEnvironmentVariable_U@12
RtlReAllocateHeap=RtlReAllocateHeap@16
RtlReleasePebLock=RtlReleasePebLock@0
RtlSecondsSince1970ToTime=RtlSecondsSince1970ToTime@8
RtlSecondsSince1980ToTime=RtlSecondsSince1980ToTime@8
RtlSetAllBits=RtlSetAllBits@4
RtlSetBits=RtlSetBits@12
RtlSetCurrentDirectory_U=RtlSetCurrentDirectory_U@4
@ -331,6 +337,11 @@ RtlSetEnvironmentVariable=RtlSetEnvironmentVariable@12
RtlSetGroupSecurityDescriptor=RtlSetGroupSecurityDescriptor@12
RtlSetOwnerSecurityDescriptor=RtlSetOwnerSecurityDescriptor@12
RtlSizeHeap=RtlSizeHeap@12
RtlTimeFieldsToTime=RtlTimeFieldsToTime@8
RtlTimeToSecondsSince1970=RtlTimeToSecondsSince1970@8
RtlTimeToSecondsSince1980=RtlTimeToSecondsSince1980@8
RtlTimeToTimeFields=RtlTimeToTimeFields@8
RtlTryEnterCriticalSection=RtlTryEnterCriticalSection@4
RtlUnicodeStringToAnsiSize=RtlUnicodeStringToAnsiSize@4
RtlUnicodeStringToAnsiString=RtlUnicodeStringToAnsiString@12
RtlUnicodeStringToCountedOemString=RtlUnicodeStringToCountedOemString@12

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.39 2000/03/09 00:13:14 ekohl Exp $
# $Id: makefile,v 1.40 2000/03/09 16:00:29 ekohl Exp $
#
# ReactOS Operating System
#
@ -30,7 +30,7 @@ DBG_OBJECTS = dbg/brkpoint.o dbg/print.o
RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \
rtl/math.o rtl/mem.o rtl/nls.o rtl/process.o rtl/sd.o \
rtl/thread.o rtl/unicode.o rtl/env.o rtl/path.o rtl/ppb.o \
rtl/bitmap.o
rtl/bitmap.o rtl/time.o
STDIO_OBJECTS = stdio/sprintf.o stdio/swprintf.o

View file

@ -29,6 +29,9 @@
#define DAYSPERLEAPYEAR 366
#define MONSPERYEAR 12
#define TICKSTO1970 0x019db1ded53e8000
#define TICKSTO1980 0x01a8e79fe1d58000
static const int YearLengths[2] = {DAYSPERNORMALYEAR, DAYSPERLEAPYEAR};
static const int MonthLengths[2][MONSPERYEAR] =
{
@ -191,4 +194,76 @@ RtlTimeFieldsToTime (
return TRUE;
}
VOID
STDCALL
RtlSecondsSince1970ToTime (
ULONG SecondsSince1970,
PLARGE_INTEGER Time
)
{
LONGLONG llTime;
llTime = (SecondsSince1970 * TICKSPERSEC) + TICKSTO1970;
*Time = *(LARGE_INTEGER *)&llTime;
}
VOID
STDCALL
RtlSecondsSince1980ToTime (
ULONG SecondsSince1980,
PLARGE_INTEGER Time
)
{
LONGLONG llTime;
llTime = (SecondsSince1980 * TICKSPERSEC) + TICKSTO1980;
*Time = *(LARGE_INTEGER *)&llTime;
}
BOOLEAN
STDCALL
RtlTimeToSecondsSince1970 (
PLARGE_INTEGER Time,
PULONG SecondsSince1970
)
{
LARGE_INTEGER liTime;
liTime.QuadPart = Time->QuadPart - TICKSTO1970;
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
if (liTime.u.HighPart != 0)
return FALSE;
*SecondsSince1970 = liTime.u.LowPart;
return TRUE;
}
BOOLEAN
STDCALL
RtlTimeToSecondsSince1980 (
PLARGE_INTEGER Time,
PULONG SecondsSince1980
)
{
LARGE_INTEGER liTime;
liTime.QuadPart = Time->QuadPart - TICKSTO1980;
liTime.QuadPart = liTime.QuadPart / TICKSPERSEC;
if (liTime.u.HighPart != 0)
return FALSE;
*SecondsSince1980 = liTime.u.LowPart;
return TRUE;
}
/* EOF */