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

Add: 'getsysdate' console command #7658

Merged
merged 5 commits into from Aug 4, 2019
Merged

Add: 'getsysdate' console command #7658

merged 5 commits into from Aug 4, 2019

Conversation

telk5093
Copy link
Contributor

@telk5093 telk5093 commented Jul 18, 2019

Add getsysdate console command to display system's local time, which is might be useful to check current time in script logging.
I have been felt that there is no command to match game date and system time, it might be helpful.

Please let me aware if something is wrong.

@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jul 18, 2019

I'm not opposed as-such to this, but together with #6193 it might be worth having a way to prevent information leakage through RCON. (Configuration flag that can't be changed via console, or similar.)

@LordAro
Copy link
Member

@LordAro LordAro commented Jul 22, 2019

I don't quite follow what use this would have. What point would accessing the system time be?

@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jul 22, 2019

My guess is for dedicated server console logging.

@telk5093
Copy link
Contributor Author

@telk5093 telk5093 commented Jul 23, 2019

@LordAro Exactly @nielsmh said, I'm using clients command in the on_server_connect.scr to identify what clients' IP is (to ban if someone vandals) and there is no way to check when a certain client joined the server.

@@ -9,6 +9,7 @@

/** @file console_cmds.cpp Implementation of the console hooks. */

#include <time.h>
Copy link
Member

@LordAro LordAro Aug 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no hard-and-fast rule for this, but standard headers are generally put at the bottom of the list on their own (but before safeguards.h)

}

time_t t;
struct tm * timeinfo;
Copy link
Member

@LordAro LordAro Aug 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for declare-before-use in C++ (or indeed C in the last 20 years)

src/console_cmds.cpp Outdated Show resolved Hide resolved
src/console_cmds.cpp Outdated Show resolved Hide resolved
src/console_cmds.cpp Outdated Show resolved Hide resolved
@telk5093
Copy link
Contributor Author

@telk5093 telk5093 commented Aug 3, 2019

@LordAro Thanks for comments, please check whether I've done right.

src/console_cmds.cpp Outdated Show resolved Hide resolved
src/console_cmds.cpp Outdated Show resolved Hide resolved
LordAro
LordAro approved these changes Aug 4, 2019
@nielsmh nielsmh merged commit bcc73bd into OpenTTD:master Aug 4, 2019
8 checks passed
douiwby pushed a commit to douiwby/OpenTTD that referenced this issue Apr 16, 2020
Add `getsysdate` console command to display system's local time, which is might be useful to check current time in script logging.
spnda pushed a commit to spnda/OpenTTD that referenced this issue Jun 17, 2020
Add `getsysdate` console command to display system's local time, which is might be useful to check current time in script logging.
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

Successfully merging this pull request may close these issues.

None yet

5 participants