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 a time-to-RFC3339 conversion function #4281

Merged
merged 4 commits into from
Sep 22, 2024

Conversation

c-cube
Copy link
Contributor

@c-cube c-cube commented Sep 21, 2024

No description provided.

this is the counterpart to the existing parsing function
`rfc3339_to_time_utc` and others. It prints the timestamp as a string,
allocated dynamically.
core/time/rfc3339.odin Outdated Show resolved Hide resolved
core/time/rfc3339.odin Outdated Show resolved Hide resolved
core/time/rfc3339.odin Outdated Show resolved Hide resolved
@Kelimion
Copy link
Member

We run our tests with -vet -strict-style. The CI is complaining that you've shadowed the offset parameter.

D:/a/Odin/Odin/core/time/rfc3339.odin(279:3) Error: Declaration of 'utc_offset' shadows declaration at line 201 
	utc_offset := abs(utc_offset) 
	^ 

I would rename the offset you're using to keep track of where you are in the buffer to index or idx. Then you can write offset := abs(utc_offset) and use that for the TZ.

Alternatively you could write utc_offset := utc_offset at the top of the procedure to let the compiler know you're intentionally shadowing what is otherwise an immutable parameter.

@c-cube
Copy link
Contributor Author

c-cube commented Sep 22, 2024

Thank you, I took the second option.

@Kelimion Kelimion merged commit ba3d545 into odin-lang:master Sep 22, 2024
7 checks passed
@c-cube c-cube deleted the add-time-to-rfc3339 branch September 22, 2024 23:10
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.

3 participants