Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to calculate process start time #974

Closed
ericeil opened this issue Aug 23, 2016 · 2 comments
Closed

Unable to calculate process start time #974

ericeil opened this issue Aug 23, 2016 · 2 comments

Comments

@ericeil
Copy link

ericeil commented Aug 23, 2016

Build: rs_prerelease 14905

Two ways to repro this:

  1. Run the following under .NET Core:
using System;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var p = System.Diagnostics.Process.GetCurrentProcess();
            Console.WriteLine(p.StartTime.ToString("F"));
        }
    }
}

Expected output: something close to the current time.
Actual output: I see a time in the far future: Sunday, April 11, 2432 7:11:56 AM.

The ps command reports similar results:

ps -o lstart,args
Sat Apr 10 05:37:01 2432 /bin/bash
Sat Apr 10 08:17:55 2432 /bin/sh -c export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; . /tmp/tmp5bfd075d549648af8a1b3c
Sat Apr 10 08:17:56 2432 bash /home/ericeil/src/corefx/bin/tests/Unix.AnyCPU.Debug/System.IO.Pipes.Tests/netcoreapp1.0/R
Sat Apr 10 08:18:01 2432 ./corerun xunit.console.netcore.exe System.IO.Pipes.Tests.dll -xml testResults.xml -notrait Ben
Sat Apr 10 09:04:31 2432 /bin/bash
Sun Apr 11 07:03:40 2432 ps -o lstart,args

Note that all processes appear to have been started in the year 2432.

I'm not sure how ps calculates this. .NET calculates it from the "starttime" field of /proc/[pid]/stat and the result of clock_gettime(CLOCK_MONOTONIC, ...).

@russalex russalex added the bug label Aug 24, 2016
@russalex
Copy link
Contributor

Thanks for reporting this one. Filed a bug against it.

Good catch.

@misenesi
Copy link

misenesi commented Nov 4, 2016

Thanks for reporting, checked in a fix for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants