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

Get system date/time without needing shell_exec() #448

Conversation

joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented May 13, 2023

One less use of shell_exec(). Maintains same output format typically used by date so no changes needed elsewhere.

Relevant to #169 and possibly #347.

It's also about 200x faster per call according to benchmarking via PHP's hrtime() on my test system, but that's 100% irrelevant unless one has a lot of admins checking their System info simultaneously. 😆

One less use of shell_exec(). Maintains same output format typically used by `date` so no changes needed elsewhere

Relevant to nextcloud#169 and possibly nextcloud#347

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
@szaimen szaimen added this to the Nextcloud 27 milestone May 14, 2023
@kesselb
Copy link
Collaborator

kesselb commented May 14, 2023

The linux command date is local aware.
Your implementation is not local aware anymore.

LC_ALL=en_US.utf8 date
LC_ALL=de_DE.utf8 date

@joshtrichards
Copy link
Member Author

Oops completely overlooked that. Have a couple ideas. I'll try to take a look later in week.

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

Successfully merging this pull request may close these issues.

4 participants