Skip to content

ps_create_time() and ps_boot_time() drifts on Linux #206

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

Open
dansmith01 opened this issue May 7, 2025 · 3 comments
Open

ps_create_time() and ps_boot_time() drifts on Linux #206

dansmith01 opened this issue May 7, 2025 · 3 comments

Comments

@dansmith01
Copy link
Contributor

I noticed that ps_create_time() will return a different process creation time, depending on the creation time of the process that queries it.

First Process:

docker run -it --rm --name test rocker/r-ver:4.5.0
install.packages('ps')
Sys.getpid()
#> [1] 1
ps::ps_create_time(ps::ps_handle(1))
#> [1] "2025-05-07 17:50:18 GMT"

(wait a few minutes before launching second process)

Second Process:

docker exec -it test R
ps::ps_create_time(ps::ps_handle(1))
#> [1] "2025-05-07 17:50:35 GMT"

(wait a few more minutes)

Third Process:

docker exec -it test R
ps::ps_create_time(ps::ps_handle(1))
#> [1] "2025-05-07 17:51:00 GMT"
@dansmith01
Copy link
Contributor Author

Looks like the btime field in /proc/stat isn't static.

@dansmith01
Copy link
Contributor Author

ps_boot_time() shows the issue a little clearer.

First Process:

docker run -it --rm --name test rocker/r-ver:4.5.0
install.packages('ps')
ps::ps_boot_time()
#> [1] "2025-05-07 17:37:16 GMT"

(wait a few minutes before launching second process)

Second Process:

docker exec -it test R
ps::ps_boot_time()
#> [1] "2025-05-07 17:37:26 GMT"

@dansmith01 dansmith01 changed the title ps_create_time() broken on Linux ps_create_time() and ps_boot_time() drifts on Linux May 7, 2025
@dansmith01
Copy link
Contributor Author

ps_boot_time() also drifts on Windows.

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

1 participant