diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-05-30 12:54:55 -0400 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2019-05-30 09:54:55 -0700 |
commit | 31acad70cae93caf0afe753775f14ebe80db31ed (patch) | |
tree | 07ada3cf5c9de6234b3e989a20d1543f1f5acea6 | |
parent | 7143390a5834d22213ffbbc04f8817b1c401fb83 (diff) | |
download | coreclr-31acad70cae93caf0afe753775f14ebe80db31ed.tar.gz coreclr-31acad70cae93caf0afe753775f14ebe80db31ed.tar.bz2 coreclr-31acad70cae93caf0afe753775f14ebe80db31ed.zip |
Add Environment.TickCount64 (#24857)
-rw-r--r-- | src/System.Private.CoreLib/src/System/Environment.CoreCLR.cs | 12 | ||||
-rw-r--r-- | src/classlibnative/bcltype/system.cpp | 8 | ||||
-rw-r--r-- | src/classlibnative/bcltype/system.h | 1 | ||||
-rw-r--r-- | src/vm/ecalllist.h | 1 |
4 files changed, 21 insertions, 1 deletions
diff --git a/src/System.Private.CoreLib/src/System/Environment.CoreCLR.cs b/src/System.Private.CoreLib/src/System/Environment.CoreCLR.cs index 69047655d4..b2d7f1165e 100644 --- a/src/System.Private.CoreLib/src/System/Environment.CoreCLR.cs +++ b/src/System.Private.CoreLib/src/System/Environment.CoreCLR.cs @@ -100,14 +100,24 @@ namespace System get => new StackTrace(true).ToString(System.Diagnostics.StackTrace.TraceFormat.Normal); } + /// <summary>Gets the number of milliseconds elapsed since the system started.</summary> + /// <value>A 32-bit signed integer containing the amount of time in milliseconds that has passed since the last time the computer was started.</value> public static extern int TickCount { [MethodImpl(MethodImplOptions.InternalCall)] get; } + /// <summary>Gets the number of milliseconds elapsed since the system started.</summary> + /// <value>A 64-bit signed integer containing the amount of time in milliseconds that has passed since the last time the computer was started.</value> + public static extern long TickCount64 + { + [MethodImpl(MethodImplOptions.InternalCall)] + get; + } + #if FEATURE_COMINTEROP - // Seperate type so a .cctor is not created for Enviroment which then would be triggered during startup + // Separate type so a .cctor is not created for Enviroment which then would be triggered during startup private static class WinRT { // Cache the value in readonly static that can be optimized out by the JIT diff --git a/src/classlibnative/bcltype/system.cpp b/src/classlibnative/bcltype/system.cpp index ce47c14e1b..18621145cf 100644 --- a/src/classlibnative/bcltype/system.cpp +++ b/src/classlibnative/bcltype/system.cpp @@ -192,6 +192,14 @@ FCIMPL0(UINT32, SystemNative::GetTickCount) } FCIMPLEND; +FCIMPL0(UINT64, SystemNative::GetTickCount64) +{ + FCALL_CONTRACT; + + return ::GetTickCount64(); +} +FCIMPLEND; + diff --git a/src/classlibnative/bcltype/system.h b/src/classlibnative/bcltype/system.h index 95670a382c..83dde4b934 100644 --- a/src/classlibnative/bcltype/system.h +++ b/src/classlibnative/bcltype/system.h @@ -52,6 +52,7 @@ public: #endif // FEATURE_PAL static FCDECL0(INT64, __GetSystemTimeAsFileTime); static FCDECL0(UINT32, GetTickCount); + static FCDECL0(UINT64, GetTickCount64); static void QCALLTYPE Exit(INT32 exitcode); diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index 343d739367..9f0abc3ce6 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -160,6 +160,7 @@ FCFuncEnd() FCFuncStart(gEnvironmentFuncs) FCFuncElement("get_TickCount", SystemNative::GetTickCount) + FCFuncElement("get_TickCount64", SystemNative::GetTickCount64) QCFuncElement("_Exit", SystemNative::Exit) FCFuncElement("set_ExitCode", SystemNative::SetExitCode) FCFuncElement("get_ExitCode", SystemNative::GetExitCode) |