Examples of errors detected by the V3118 diagnostic.


V3118. A component of TimeSpan is used, which does not represent full time interval. Possibly 'Total*' value was intended instead.


Orchard CMS

V3118 Seconds component of TimeSpan is used, which does not represent full time interval. Possibly 'TotalSeconds' value was intended instead. AssetUploader.cs 182


void IBackgroundTask.Sweep()
{
  ....
  // Don't flood the database with progress updates;
  // Limit it to every 5 seconds.
  if ((_clock.UtcNow - lastUpdateUtc).Seconds >= 5)
  {
    ....
  }
}

Media Portal 2

V3118 Milliseconds component of TimeSpan is used, which does not represent full time interval. Possibly 'TotalMilliseconds' value was intended instead. Default.cs 60


private void WaitForNextFrame()
{
  double msToNextFrame = _msPerFrame -
    (DateTime.Now - _frameRenderingStartTime).Milliseconds;
  if (msToNextFrame > 0)
    Thread.Sleep(TimeSpan.FromMilliseconds(msToNextFrame));
}

MSBuild

V3118 Milliseconds component of TimeSpan is used, which does not represent full time interval. Possibly 'TotalMilliseconds' value was intended instead. MSBuild XMake.cs 629


public static ExitType Execute(string commandLine)
{
  ....
  if (!String.IsNullOrEmpty(timerOutputFilename))
  {
      AppendOutputFile(timerOutputFilename,
                       elapsedTime.Milliseconds);
  }
  ....
}


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;