-
Notifications
You must be signed in to change notification settings - Fork 34
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
Skips four hour increment with UTC on some occasions #43
Comments
Hello @honglooker, thanks for the detailed error report, I'll be looking into it soon.
As a workaround, would the simplified |
Notes, in passing: ENV['TZ'] = 'UTC'
p Time.now
# 2020-09-15 02:47:23 +0000
p (Time.zone rescue "no Time.zone method")
# "no Time.zone method"
require 'active_support/time'
p Time.now
# 2020-09-15 02:47:24 +0000
p Time.zone
# nil
Time.use_zone('America/New_York') do
p Time.now
# 2020-09-15 02:47:24 +0000
p Time.zone
# #<ActiveSupport::TimeZone:0x4f2544b0
# @name="America/New_York",
# @utc_offset=nil, @tzinfo=#<TZInfo::TimezoneProxy: America/New_York>>
p Time.parse('2020-09-11 12:00:00')
# 2020-09-11 12:00:00 +0000
p Time.parse('2020-09-11 12:00:00').zone
# "UTC"
p Time.zone.parse('2020-09-11 12:00:00')
# Fri, 11 Sep 2020 12:00:00 EDT -04:00
p Time.zone.parse('2020-09-11 12:00:00').zone
# "EDT"
end |
@honglooker what version of the |
Hey, thanks for the update. I tried
but it still seems to yield: My version of et-orbi is .. hmm. I see two lines in the lockfile:
I want to say |
@honglooker it's |
No prob! :) |
what does
yield in your environment? (It's supposed to look like
) Thanks in advance. |
Note: Looks like jruby for this
Note: nil because I manually set timezone via system settings
Note: interesting failure here. Surprised to see a stacktrace. Maybe because my repro gemfile does not explicitly import EtOrbi? Should be there as a dependency... Let me know if you need anything else from me. Thanks again for taking a look! |
Got it. Had to
Thanks again! |
@honglooker wrote:
Thanks, I wanted to double check that it wasn't set on top of the system settings. EtOrbi and Fugit do follow |
Gotcha, thanks for clarifying. |
I think that's the cause of the skip: I'll investigate further during my next break. |
@honglooker Hello, I think the fix above solves your issue. If you could verify on your side and let me know. Thanks in advance! |
Hey, thanks for the quick fix! I gave it a try: ...
Using fugit 1.3.9 from git://github.com/floraison/fugit (at master@6792de1)
...
❯ bundle exec ruby utc_repro.rb
2020-09-11 16:00:00 UTC I'm getting 16:00, which is 12:00 eastern time -- it works. Thank you for the fast turnaround time! |
OK, thanks again, I'll release 1.3.9 soon and then close the issue. I'm happy you circled this one. |
Great, thank you! |
Fugit 1.3.9 is available. Thanks a lot! |
Perfect, much appreciated! |
Issue description
Hi, thanks for making this library, it's been really useful.
We're running into an issue with this cron:
0 8-19/4 * * *
.We basically want it to run every day from 8am to 7pm with a 4-hour increment, which boils down to 8am, 12pm, and 4pm.
We're having issues when we set the timezone to
America/New_York
, but have the system time inUTC
.If we query for the
next
time at 8am,fugit
yields20:00 UTC
(4pm EST) when we expect16:00 UTC
(12pm EST). It seems to skip a 4-hour block when requestingnext
right on the edge.How to reproduce
Gemfile
utc_repro.rb
UTC
bundle install
ruby utc_repro.rb
Error
Running
ruby utc_repro.rb
yields2020-09-11 20:00:00 UTC
when we would expect
2020-09-11 16:00:00 UTC
.Context
We're using jruby 9.2.13.0, but
MRI
should yield the same results.Lastly, if we update the time and add a few minutes (e.g. try
12:10 UTC
), we get the expected time:puts Time.use_zone('America/New_York') { cron.next_time(Time.parse('2020-09-11 12:10:00')).to_local_time }
yields
2020-09-11 16:00:00 UTC
.Feel free to let me know if anything is unclear, happy to clarify.
The text was updated successfully, but these errors were encountered: