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

[Bug]: getsysdate returns a blank value (instead of the current date and time) #9974

Closed
James103 opened this issue Aug 23, 2022 · 1 comment

Comments

@James103
Copy link
Contributor

Version of OpenTTD

882b8f4 on Windows 10, 64-bit (via Steam)

Expected result

getsysdate should return the current date and time.

Actual result

getsysdate returns a blank value, as shown below.

getsysdate
System Date: 

Steps to reproduce

  1. Run OpenTTD.
  2. Run getsysdate from the console.
  3. Notice it returns a blank value.

Tested on master 882b8f4, JGRPP 0.47.2, and JGRPP 0.48.1. All three versions return a blank value when running getsysdate.

@JGRennison
Copy link
Contributor

The buffer is one byte too small (due to the null terminator).
strftime returns 0 and the contents of the output buffer is undefined in this case.
On Linux I get a result like "2022-08-23 15:00:h" followed by some unprintables.

glx22 added a commit to glx22/OpenTTD that referenced this issue Aug 23, 2022
strftime() return value doesn't count NULL character, but buffer size must include it.
glx22 added a commit to glx22/OpenTTD that referenced this issue Aug 23, 2022
strftime() return value doesn't count NULL character, but buffer size must include it.
@glx22 glx22 closed this as completed in e3968cd Aug 23, 2022
Joel-Milligan pushed a commit to Joel-Milligan/OpenTTD that referenced this issue Nov 10, 2022
strftime() return value doesn't count NULL character, but buffer size must include it.
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

2 participants