floraison / fugit

time tools (cron, parsing, durations, ...) for Ruby, rufus-scheduler, and flor
MIT License
355 stars 29 forks source link

Fugit::Cron previous_time method bug #33

Closed zephyrpathsofglory closed 4 years ago

zephyrpathsofglory commented 4 years ago

Hi, there:

I was in +8 timezone, I exec the following statement in rails console: Fugit::Cron.parse('0 16 30 9 *').previous_time.to_local_time

and I got the following error: RuntimeError: too many loops for "0 16 30 9 *" #previous_time, breaking

Also, the same error occurred when I exec: Fugit::Cron.parse('0 16 31 10 *').previous_time.to_local_time

I guess that when the cron is across the month, this error occurred. So boundary conditions need
to be fully considered

jmettraux commented 4 years ago

@zhangyonguu Hello, could you please update your issue to indicate what version of fugit and what version of Ruby you are using? Thanks in advance.

zephyrpathsofglory commented 4 years ago

@jmettraux, my fugit version is 1.1.8 and my Ruby version is 2.4.1

jmettraux commented 4 years ago

@zhangyonguu Oh, one more thing. Could you please give me the output of the three following commands on your system and in your Rails project?

uname -a                                                                                     
ruby -v                                                                          
bundle exec ruby -r et-orbi -e "EtOrbi._make_info"  

Thanks in advance!

zephyrpathsofglory commented 4 years ago

@jmettraux

Darwin
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin18]

(secs:1569835319.8472419,utc~:"2019-09-30 09:21:59.8472418785095215",ltz~:"CST")
(etz:nil,tnz:"CST",tziv:"1.2.5",tzidv:nil,rv:"2.4.1",rp:"x86_64-darwin18",win:false,rorv:nil,astz:nil,eov:"1.1.7",eotnz:#<TZInfo::TimezoneProxy: Asia/Chongqing>,eotnfz:"+0800",eotlzn:"Asia/Chongqing",eotnfZ:"CST",debian:nil,centos:nil,osx:"zoneinfo/Asia/Shanghai")
jmettraux commented 4 years ago

@jmettraux, my fugit version is 1.1.8 and my Ruby version is 2.4.1

Ah, then could you please upgrade your fugit version to the latest which is 1.3.3 (https://rubygems.org/gems/fugit/versions/1.3.3). It should fix the issue.

According to the https://github.com/floraison/fugit/blob/master/CHANGELOG.md it should be fixed at 1.1.9.

Please tell me how it turns out. Thanks in advance.

zephyrpathsofglory commented 4 years ago

@jmettraux , yes, it works! Thank you!

jmettraux commented 4 years ago

You're welcome. Have a good evening!