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

Version 2.0.1 #22

Merged
merged 3 commits into from
Aug 22, 2024
Merged

Version 2.0.1 #22

merged 3 commits into from
Aug 22, 2024

Conversation

stevegrunwell
Copy link
Owner

@stevegrunwell stevegrunwell commented Aug 22, 2024

In version 1.x, the constants were defined in the global namespace so it was responsible to explicitly check that, for instance, `HOUR_IN_SECONDS` was not already defined before attempting to define it.

Now that the constants are namespaced, this just adds unnecessary overhead: if someone else is defining constants in the `TimeConstants` namespace, there are bigger problems. Additionally, IDEs seem to trip over the `defined()` checks, not being sure that the constants exist. They do.

Similarly, while it was fun writing the intial constants in a way that they build upon each other, there's really no reason that this file should have to confirm (for example) that 24 hours * 60 minutes/hour = 1440 minutes/hour. These values do not change (hence *constants*), so save a little bit of basic multiplication by hard-coding the values.
Skip defined() checks, unnecessary multiplication
@stevegrunwell stevegrunwell added the release Preparing for a release label Aug 22, 2024
@stevegrunwell stevegrunwell merged commit de474c5 into main Aug 22, 2024
3 checks passed
@stevegrunwell stevegrunwell deleted the release/v2.0.1 branch August 22, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release Preparing for a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant