-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip defined() checks, unnecessary multiplication
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.
- Loading branch information
1 parent
e6e7761
commit c648d34
Showing
1 changed file
with
74 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters