-
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
cron #previous_time loop breaker issue #95
Comments
Note that with a similar timezone, it works: Fugit.parse_cron("20 0 * * 1%2 America/Santarem").previous_time
=> #<EtOrbi::EoTime:0x00007aeb992c42c8 @seconds=1709522400.0, @time=nil, @zone=#<TZInfo::DataTimezone: Etc/UTC>> |
require 'fugit'
def test(x)
puts
puts " --- #{x} ---"
c = Fugit.parse_cron(x)
begin
puts c.previous_time.strftime('%F %T %:z %A')
rescue => err
p err
end
begin
puts c.next_time.strftime('%F %T %:z %A')
rescue => err
p err
end
end
#Fugit.parse_cron('21 0 * * 1%2')
test('21 0 * * 1%2')
test('21 0 * * 1%1')
# minute hour day-of-month month day-of-week [flags] command
test('21 0 * * 1%2 UTC')
test('21 0 * * 1%2 America/Chicago')
test('21 0 * * 1%2 America/New_York')
test('21 0 * * 1%2 America/Rio_Branco')
test('21 0 * * 1%2 America/Manaus')
test('21 0 * * 1%2 America/Belem')
test('21 0 * * 1%2 America/Fortaleza')
test('21 0 * * 1%2 America/Recife')
test('21 0 * * 1%2 America/Araguaina')
test('21 0 * * 1%2 America/Maceio')
test('21 0 * * 1%2 America/Bahia')
test('21 0 * * 1%2 America/Sao_Paulo')
test('21 0 * * 1%2 America/Campo_Grande')
test('21 0 * * 1%2 America/Cuiaba')
test('21 0 * * 1%2 America/Santarem')
test('21 0 * * 1%2 America/Porto_Velho')
test('21 0 * * 1%2 America/Boa_Vista')
test('21 0 * * 1%2 America/Manaus')
test('21 0 * * 1%2 America/Eirunepe')
test('21 0 * * 1%2 America/Rio_Branco')
puts
|
p EtOrbi.make_time('2019-01-01 00:00:00', 'America/Sao_Paulo')
p EtOrbi.make_time('2019-01-01 00:00:00', 'America/Santarem')
p EtOrbi.make_time('2019-01-01 00:00:00', 'America/Sao_Paulo').to_s
p EtOrbi.make_time('2019-01-01 00:00:00', 'America/Santarem').to_s
The modulo system for weekdays uses the https://www.timeanddate.com/time/zone/brazil/sao-paulo The Sao Paulo timezone had daylight saving time until 2019, The Santarem seems not to have DST, hence the -0200 for Sao Paulo (until 2019 Feb 17). I could a) increase the iteration count from 2048 to 2048 * 2, but that would result in I prefer b) but I would draw some flak for it from disgruntled users. a) does not seem right. Pondering. |
Please upgrade et-orbi to 1.2.9, it should solve the issue (at least that's what the specs tell me). Closing the issue, please tell me if there is anything else. Merci beaucoup ! |
@jmettraux we've just tested it and it's working fine for us, thank you for your help and fast response time 🙏 |
Great! A star would be welcome ;-) |
Issue description
Error when using
Fugit.parse_cron
with #previous_time on a specific Time zone (seems to work when using other timezone, tested withAmerica/Chicago
for ex)How to reproduce
The simplest piece of code that reproduces the issue, for example:
Error and error backtrace (if any)
Expected behaviour
Something equivalent to:
Context
Please replace the content of this section with the output of the following commands:
The text was updated successfully, but these errors were encountered: