-
Notifications
You must be signed in to change notification settings - Fork 131
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
re #347 Add a system-level keyword to specify that COSMOS should glob… #457
Conversation
…ally use UTC times.
Unfortunately can't monkey patch core Time methods without almost certainly breaking other ruby libraries. Will have to change to the massive search/replace option. |
@ryanatball Fair enough, I figured this was pretty risky (although I did learn a lot). A couple possible ideas:
It feels like the first option is more likely to be correct in all cases. Do you have a preference? Or is there a better way that I'm not thinking of? |
Probably the CosmosTime option. I think you may need to make some more changes to the new() method as well. The changes you've made change how time will be formatted into a string, but not how time is entered. For example .new seems to always accept entry in local time units (probably needs to change to accommodate entry from UTC?). Also .at() always takes entry in UTC (probably should NOT change). |
…ing core Time methods.
@ryanatball This should be ready for review now. I ended up going with the .sys() function in the Time class for a few reasons:
|
👍 Looks great Donald. |
…ally use UTC times.
Note to reviewer: Under the hood, this implementation uses a monkey patch to the Time class so that Time objects created with new, now, and at are set up to be local or UTC depending on the system setting. I know touching core classes that way is a scary proposition, but this was the only way that I could come up with to consistently apply a Time Zone setting all across COSMOS. Another option would maybe be to derive a special CosmosTime class, but that seems like it'd be a lot of search'n'replace work, and hard to enforce usage in the future.