fugit: Endless loop after call Fugit::Cron#next_time with time zone 'CST'
environment:
- ruby 2.3.3p222
- fugit 1.1.6
Time.now.zoneisCST(+08:00)
code:
Time.now.utc # "2019-01-02T05:25:53.960Z"
cron = Fugit.do_parse_cron('0 0 1 1 *')
cron.next_time.to_s
expected:
"2019-12-01 00:00:00 +0000"
got:
Endless loop
What I found:
After some debugging, I thought the method TimeCursor#inc_mont doesn’t work right in timezone CST (maybe all positive east of UTC timezones).
https://github.com/floraison/fugit/blob/6488c5f4e47ac63a2a5b7f290656a344ff9d2ca9/lib/fugit/cron.rb#L88
This line will parse the year and month as time zone CST, and then transfer to UTC.
For example:
::EtOrbi.make(2019, 2).to_s
expected: 2019-02-01 00:00:00 +0000
but got: 2019-01-31 16:00:00 +0000
The month isn’t increased, and the loop in next_time will last forever.
Thank you for your work.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 26 (15 by maintainers)
Commits related to this issue
- Add (failing) specs for fugit issue 11 https://github.com/floraison/fugit/issues/11 — committed to floraison/et-orbi by jmettraux 5 years ago
- Tighten EtOrbi.extract_zone, enable Chronic + tz https://github.com/floraison/fugit/issues/11 — committed to floraison/et-orbi by jmettraux 5 years ago
- Align spec infra on et-orbi spec infra, gh-11 — committed to floraison/fugit by jmettraux 5 years ago
- Turn @w11th code into a spec, gh-11 — committed to floraison/fugit by jmettraux 5 years ago
- Depend on et-orbi, ~> 1.1, >= 1.1.7, gh-11 — committed to floraison/fugit by jmettraux 5 years ago
Thanks @godfat !
I am opening a new issue, I think it has nothing to do with the original issue here. Stay tuned.
Hello again @godfat,
sorry, your issue is simpler. As you mentioned a “day of month” of 0 should not be accepted. I opened gh-13 just for that. No need for further information.
Thank you very much, I will fix that.
Hello @godfat,
could you please give me more details? What does
bundle exec ruby -r et-orbi -e "EtOrbi._make_info"yield on your platform? What version of Ruby, what operating system?Thanks in advance.