fugit 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fugit might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0a2fdae36b04308242e58a5da6b2d5e65e749cb10b02d0d408988611067e46b
4
- data.tar.gz: 19d7a91ec345a2b35c1b7568e3a6cfe4e70fc6f780e0332972507bbef6bda0e7
3
+ metadata.gz: 30b1280ebc1d629dbbdcba1b02718a535b0fdec70c9d690f3d5208181ffe4577
4
+ data.tar.gz: 918af2ece3f4c94eb1145b60da397a43ee574023831bae4b7c0b95e6a97e389b
5
5
  SHA512:
6
- metadata.gz: 1f5eccb6a96c688390dfdf231ba30812b05bdb22010ff1820b08eae5348809dd5793900c45c073500b8e1358ab90b4e40ee6bfd8badf4838d8e5b13a1d0f1428
7
- data.tar.gz: 69fdda6d16c19beebae198a0610d69ab4496f1873b2ee7b825737f635ffd8744d054436f0b51dd372caa45e2945d8051d6a191b89ecd27d3c4a8b72bca59cffa
6
+ metadata.gz: 37b8ad132efdd2b9be99fb9fd1ab6f505024fd309865cf007d9ade6df20207a4165e49679a4113614010f7436ddbf28e2fc6ecbdbbedc713bb3e4def3f2b03ca
7
+ data.tar.gz: 4fc6e3a8f080b698151cc6dadfb1d2869cb736a4e6c60ce7fe6c26a598f83b693d32f37edd1f42cd20dd0efdb47dd04cde097fca07d0bf5fe6eb9412b72ef0cf
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## fugit 1.4.3 released 2021-03-23
6
+
7
+ * Fix entering DST issue, gh-53
8
+
9
+
5
10
  ## fugit 1.4.2 released 2021-01-12
6
11
 
7
12
  * Fix Fugit::Cron.previous_time vs last day of month, gh-51
data/CREDITS.md CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  # fugit credits
3
3
 
4
+ * Andy Pfister https://github.com/andyundso gh-53, entering DST
4
5
  * Solteszad https://github.com/solteszad gh-51, fix previous_time vs last day of month
5
6
  * Niklas https://github.com/gr8bit gh-49, Fugit::Cron.parse('')
6
7
  * Matsuda Akira https://github.com/amatsuda gh-46, warning suppression
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  # fugit
3
3
 
4
- [![Build Status](https://secure.travis-ci.org/floraison/fugit.svg)](http://travis-ci.org/floraison/fugit)
4
+ [![tests](https://github.com/floraison/fugit/workflows/test/badge.svg)](https://github.com/floraison/fugit/actions)
5
5
  [![Gem Version](https://badge.fury.io/rb/fugit.svg)](http://badge.fury.io/rb/fugit)
6
6
  [![Join the chat at https://gitter.im/floraison/fugit](https://badges.gitter.im/floraison/fugit.svg)](https://gitter.im/floraison/fugit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7
7
 
@@ -350,6 +350,10 @@ Fugit::Nat.parse('every day at 16:15 nada 18:30', multi: true)
350
350
 
351
351
  `multi: false` is the default behaviour, return a single `Fugit::Cron` instance or nil when it cannot parse.
352
352
 
353
+ ### Nat Midnight
354
+
355
+ `"Every day at midnight"` is supported, but `"Every monday at midnight"` will be interpreted (as of Fugit <= 1.4.x) as `"Every monday at 00:00"`. Sorry about that.
356
+
353
357
 
354
358
  ## LICENSE
355
359
 
data/lib/fugit.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Fugit
4
4
 
5
- VERSION = '1.4.2'
5
+ VERSION = '1.4.3'
6
6
  end
7
7
 
8
8
  require 'time'
data/lib/fugit/cron.rb CHANGED
@@ -79,10 +79,7 @@ module Fugit
79
79
  %w[ year month day wday hour min sec wday_in_month rweek rday ]
80
80
  .collect(&:to_sym).each { |k| define_method(k) { @t.send(k) } }
81
81
 
82
- def inc(i)
83
- @t = @t + i
84
- self
85
- end
82
+ def inc(i); @t = @t + i; self; end
86
83
  def dec(i); inc(-i); end
87
84
 
88
85
  def inc_month
@@ -95,6 +92,7 @@ module Fugit
95
92
 
96
93
  def inc_day
97
94
  inc((24 - @t.hour) * 3600 - @t.min * 60 - @t.sec)
95
+ inc( - @t.hour * 3600) if @t.hour != 0 # compensate for entering DST
98
96
  end
99
97
  def inc_hour
100
98
  inc((60 - @t.min) * 60 - @t.sec)
@@ -112,7 +110,7 @@ module Fugit
112
110
  end
113
111
 
114
112
  def dec_month
115
- dec((@t.day - 1) * 24 * 3600 + @t.hour * 3600 + @t.min * 60 + @t.sec + 1)
113
+ dec((@t.day - 1) * DAY_S + @t.hour * 3600 + @t.min * 60 + @t.sec + 1)
116
114
  end
117
115
 
118
116
  def dec_day
@@ -332,7 +330,7 @@ module Fugit
332
330
  [ :seconds, 1, 60 ],
333
331
  [ :minutes, 60, 60 ],
334
332
  [ :hours, 3600, 24 ],
335
- [ :days, 24 * 3600, 365 ] ].freeze
333
+ [ :days, DAY_S, 365 ] ].freeze
336
334
 
337
335
  def rough_frequency
338
336
 
@@ -374,7 +372,7 @@ module Fugit
374
372
 
375
373
  @delta_min = deltas.min; @delta_max = deltas.max
376
374
  @occurrences = deltas.size
377
- @span_years = span / (365 * 24 * 3600)
375
+ @span_years = span / YEAR_S
378
376
  @yearly_occurrences = @occurrences.to_f / @span_years
379
377
  end
380
378
 
@@ -61,10 +61,10 @@ module Fugit
61
61
  end
62
62
 
63
63
  KEYS = {
64
- yea: { a: 'Y', r: 'y', i: 'Y', s: 365 * 24 * 3600, x: 0, l: 'year' },
65
- mon: { a: 'M', r: 'M', i: 'M', s: 30 * 24 * 3600, x: 1, l: 'month' },
66
- wee: { a: 'W', r: 'w', i: 'W', s: 7 * 24 * 3600, I: true, l: 'week' },
67
- day: { a: 'D', r: 'd', i: 'D', s: 24 * 3600, I: true, l: 'day' },
64
+ yea: { a: 'Y', r: 'y', i: 'Y', s: YEAR_S, x: 0, l: 'year' },
65
+ mon: { a: 'M', r: 'M', i: 'M', s: 30 * DAY_S, x: 1, l: 'month' },
66
+ wee: { a: 'W', r: 'w', i: 'W', s: 7 * DAY_S, I: true, l: 'week' },
67
+ day: { a: 'D', r: 'd', i: 'D', s: DAY_S, I: true, l: 'day' },
68
68
  hou: { a: 'h', r: 'h', i: 'H', s: 3600, I: true, l: 'hour' },
69
69
  min: { a: 'm', r: 'm', i: 'M', s: 60, I: true, l: 'minute' },
70
70
  sec: { a: 's', r: 's', i: 'S', s: 1, I: true, l: 'second' } }.freeze
data/lib/fugit/misc.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  module Fugit
4
4
 
5
+ DAY_S = (24 * 3600).freeze
6
+ YEAR_S = (365 * DAY_S).freeze
7
+
5
8
  class << self
6
9
 
7
10
  def isostamp(show_date, show_time, show_usec, time)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fugit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-12 00:00:00.000000000 Z
11
+ date: 2021-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raabro