@@ -364,7 +364,7 @@ public void TestProcessorTime()
364
364
Assert . InRange ( processorTimeAtHalfSpin , processorTimeBeforeSpin , Process . GetCurrentProcess ( ) . TotalProcessorTime . TotalSeconds ) ;
365
365
}
366
366
367
- [ Fact , ActiveIssue ( "https://github.com/dotnet/corefx/issues/2613" , PlatformID . Linux ) ]
367
+ [ Fact ]
368
368
public void TestProcessStartTime ( )
369
369
{
370
370
DateTime timeBeforeCreatingProcess = DateTime . UtcNow ;
@@ -378,18 +378,19 @@ public void TestProcessStartTime()
378
378
// Time in unix, is measured in jiffies, which is incremented by one for every timer interrupt since the boot time.
379
379
// Thus, because there are HZ timer interrupts in a second, there are HZ jiffies in a second. Hence 1\HZ, will
380
380
// be the resolution of system timer. The lowest value of HZ on unix is 100, hence the timer resolution is 10 ms.
381
- // Allowing for error in 10 ms.
382
- long tenMSTicks = new TimeSpan ( 0 , 0 , 0 , 0 , 10 ) . Ticks ;
383
- long beforeTicks = timeBeforeCreatingProcess . Ticks - tenMSTicks ;
381
+ // On Windows, timer resolution is 15 ms from MSDN DateTime.Now. Hence, allowing error in 15ms [max(10,15)].
382
+
383
+ long intervalTicks = new TimeSpan ( 0 , 0 , 0 , 0 , 15 ) . Ticks ;
384
+ long beforeTicks = timeBeforeCreatingProcess . Ticks - intervalTicks ;
384
385
385
386
try
386
387
{
387
388
// Ensure the process has started, p.id throws InvalidOperationException, if the process has not yet started.
388
389
Assert . Equal ( p . Id , Process . GetProcessById ( p . Id ) . Id ) ;
389
-
390
- long afterTicks = DateTime . UtcNow . Ticks + tenMSTicks ;
391
- Assert . InRange ( p . StartTime . ToUniversalTime ( ) . Ticks , beforeTicks , afterTicks ) ;
392
- }
390
+ long startTicks = p . StartTime . ToUniversalTime ( ) . Ticks ;
391
+ long afterTicks = DateTime . UtcNow . Ticks + intervalTicks ;
392
+ Assert . InRange ( startTicks , beforeTicks , afterTicks ) ;
393
+ }
393
394
catch ( InvalidOperationException )
394
395
{
395
396
Assert . True ( p . StartTime . ToUniversalTime ( ) . Ticks > beforeTicks ) ;
0 commit comments