et-orbi 1.2.7 → 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/CREDITS.md +7 -4
- data/LICENSE.txt +1 -1
- data/Makefile +4 -4
- data/README.md +0 -1
- data/lib/et-orbi/time.rb +59 -22
- data/lib/et-orbi.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7f008f08099e4efe55b1cdeef327f9dd043703196609615e52ec20499db141e
|
4
|
+
data.tar.gz: d7d636ce1eaf898dbf76b8d8c94ea3aeaab02a462e9e646ead51502f975dcb93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3fbfbef817e8c176a66d38edac9924e8f557fbb12bceddc42249bdd773f74b1fa3792f6a3c7cfff1f3ecd1bf13ff293de7baa0f84da3418cd171574d8984c40
|
7
|
+
data.tar.gz: 2c3176e291230ad074b11d475a823cfa6cbce12cd55295337fcf1c36a9bdf7b35453801d3d940bd72308420594afae61a31a96ff4282fc0e9cc966c02d3ddfaf
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,26 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
+
## et-orbi 1.2.11 released 2024-03-23
|
6
|
+
|
7
|
+
- Cache @rweek and @rday, not @ref, gh-38
|
8
|
+
|
9
|
+
|
10
|
+
## et-orbi 1.2.10 released 2024-03-22
|
11
|
+
|
12
|
+
- Refine #rweek computation, aim more at noon instead of midnight, gh-38
|
13
|
+
|
14
|
+
|
15
|
+
## et-orbi 1.2.9 released 2024-03-13
|
16
|
+
|
17
|
+
- Refine #rweek computation, aim at noon instead of midnight, gh-38
|
18
|
+
|
19
|
+
|
20
|
+
## et-orbi 1.2.8 released 2024-03-11 (13 ans)
|
21
|
+
|
22
|
+
- Cache the @ref time used in the #rweek and #rday computation
|
23
|
+
|
24
|
+
|
5
25
|
## et-orbi 1.2.7 released 2022-03-09
|
6
26
|
|
7
27
|
- Fix the wday_in_month computation for floraison/fugit#67
|
data/CREDITS.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
|
2
2
|
# et-orbi credits
|
3
3
|
|
4
|
+
* Benjami Darcet https://github.com/bdarcet https://github.com/floraison/fugit/issues/67 gh-38
|
5
|
+
* https://github.com/franckduche https://github.com/floraison/fugit/issues/67 gh-38
|
6
|
+
* Igor Viktor https://github.com/gogainda gh-34
|
4
7
|
* phibid, for https://github.com/floraison/fugit/issues/67
|
5
8
|
* Peter Goldstein, https://github.com/petergoldstein GHA 3.3 j9.3, gh-32
|
6
|
-
* harsha-flipp
|
7
|
-
* adank92
|
8
|
-
* Stan Hu
|
9
|
-
* d-m-u
|
9
|
+
* harsha-flipp https://github.com/harsha-flipp https://github.com/floraison/fugit/issues/63
|
10
|
+
* adank92 https://github.com/adank92 https://github.com/ondrejbartas/sidekiq-cron/issues/276 gh-28
|
11
|
+
* Stan Hu https://github.com/stanhu Chronic toubles, gh-24, gh-26, etc
|
12
|
+
* d-m-u https://github.com/d-m-u EoTime#==(Time), gh-20, gh-7
|
10
13
|
* Vais Salikhov (https://github.com/vais) missing US timezone aliases, gh-18 gh-19
|
11
14
|
* Wenhui Wang https://github.com/w11th .parse vs Chronic+ActiveSupport, fugit 11
|
12
15
|
* Marcel https://github.com/MTRNord "Mitteleuropaeische Sommerzeit", gh-15
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c) 2017-
|
2
|
+
Copyright (c) 2017-2024, John Mettraux, jmettraux+flor@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/Makefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
## gem tasks ##
|
3
3
|
|
4
|
-
NAME
|
5
|
-
|
6
|
-
VERSION
|
7
|
-
|
4
|
+
NAME != \
|
5
|
+
ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name"
|
6
|
+
VERSION != \
|
7
|
+
ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.version"
|
8
8
|
|
9
9
|
count_lines:
|
10
10
|
find lib -name "*.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
|
data/README.md
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
[![tests](https://github.com/floraison/et-orbi/workflows/test/badge.svg)](https://github.com/floraison/et-orbi/actions)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/et-orbi.svg)](http://badge.fury.io/rb/et-orbi)
|
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
6
|
|
8
7
|
Time zones for [fugit](https://github.com/floraison/fugit) and for [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler). Urbi et Orbi.
|
9
8
|
|
data/lib/et-orbi/time.rb
CHANGED
@@ -88,20 +88,35 @@ module EtOrbi
|
|
88
88
|
(defined?(TZInfo::Data) ? '' : "\nand adding gem 'tzinfo-data'")
|
89
89
|
) unless @zone
|
90
90
|
|
91
|
+
touch
|
92
|
+
end
|
93
|
+
|
94
|
+
# Nullify the "caches" used by #to_time, #rweek, and others
|
95
|
+
#
|
96
|
+
def touch
|
97
|
+
|
91
98
|
@time = nil
|
92
|
-
|
99
|
+
@rday = nil
|
100
|
+
@rweek = nil
|
93
101
|
end
|
94
102
|
|
95
103
|
def seconds=(f)
|
96
104
|
|
97
|
-
@time = nil
|
98
105
|
@seconds = f
|
106
|
+
|
107
|
+
touch
|
108
|
+
|
109
|
+
f
|
99
110
|
end
|
100
111
|
|
101
112
|
def zone=(z)
|
102
113
|
|
103
|
-
|
114
|
+
|
104
115
|
@zone = self.class.get_tzone(zone || :current)
|
116
|
+
|
117
|
+
touch
|
118
|
+
|
119
|
+
@zone
|
105
120
|
end
|
106
121
|
|
107
122
|
# Returns true if this EoTime instance corresponds to 2 different UTC
|
@@ -230,8 +245,8 @@ module EtOrbi
|
|
230
245
|
def <=(o); @seconds <= _to_f(o); end
|
231
246
|
def <=>(o); @seconds <=> _to_f(o); end
|
232
247
|
|
233
|
-
def add(t); @
|
234
|
-
def subtract(t); @
|
248
|
+
def add(t); @seconds += t.to_f; touch; self; end
|
249
|
+
def subtract(t); @seconds -= t.to_f; touch; self; end
|
235
250
|
|
236
251
|
def +(t); inc(t, 1); end
|
237
252
|
def -(t); inc(t, -1); end
|
@@ -301,19 +316,24 @@ module EtOrbi
|
|
301
316
|
|
302
317
|
def inc(t, dir=1)
|
303
318
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
319
|
+
r =
|
320
|
+
case t
|
321
|
+
when Numeric
|
322
|
+
nt = self.dup
|
323
|
+
nt.seconds += dir * t.to_f
|
324
|
+
nt
|
325
|
+
when ::Time, ::EtOrbi::EoTime
|
326
|
+
fail ArgumentError.new(
|
327
|
+
"Cannot add #{t.class} to EoTime") if dir > 0
|
328
|
+
@seconds + dir * t.to_f
|
329
|
+
else
|
330
|
+
fail ArgumentError.new(
|
331
|
+
"Cannot call add or subtract #{t.class} to EoTime instance")
|
332
|
+
end
|
333
|
+
|
334
|
+
touch
|
335
|
+
|
336
|
+
r
|
317
337
|
end
|
318
338
|
|
319
339
|
def localtime(zone=nil)
|
@@ -330,16 +350,28 @@ module EtOrbi
|
|
330
350
|
- count_weeks(EtOrbi.make_time(strftime('%F 12:00:00 %/Z')) , 1) ]
|
331
351
|
end
|
332
352
|
|
353
|
+
# "reference week", used in fugit for cron modulo notation
|
354
|
+
#
|
333
355
|
def rweek
|
334
356
|
|
335
|
-
|
336
|
-
|
357
|
+
@rweek ||=
|
358
|
+
begin
|
359
|
+
ref = EtOrbi.make_time('2019-01-01 12:00:00', @zone)
|
360
|
+
noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
|
361
|
+
((noon - ref) / WEEK_S).floor + 1
|
362
|
+
end
|
337
363
|
end
|
338
364
|
|
365
|
+
# "reference week", used in fugit for cron modulo notation
|
366
|
+
#
|
339
367
|
def rday
|
340
368
|
|
341
|
-
|
342
|
-
|
369
|
+
@rday ||=
|
370
|
+
begin
|
371
|
+
ref = EtOrbi.make_time('2019-01-01 12:00:00', @zone)
|
372
|
+
noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
|
373
|
+
((noon - ref) / DAY_S).floor + 1
|
374
|
+
end
|
343
375
|
end
|
344
376
|
|
345
377
|
def reach(points)
|
@@ -374,6 +406,11 @@ module EtOrbi
|
|
374
406
|
t
|
375
407
|
end
|
376
408
|
|
409
|
+
def clone
|
410
|
+
|
411
|
+
EtOrbi::EoTime.new(@seconds, @zone)
|
412
|
+
end
|
413
|
+
|
377
414
|
protected
|
378
415
|
|
379
416
|
# Returns a Ruby Time instance.
|
data/lib/et-orbi.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: et-orbi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -82,7 +82,7 @@ metadata:
|
|
82
82
|
bug_tracker_uri: https://github.com/floraison/et-orbi/issues
|
83
83
|
homepage_uri: https://github.com/floraison/et-orbi
|
84
84
|
source_code_uri: https://github.com/floraison/et-orbi
|
85
|
-
post_install_message:
|
85
|
+
post_install_message:
|
86
86
|
rdoc_options: []
|
87
87
|
require_paths:
|
88
88
|
- lib
|
@@ -97,8 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.
|
101
|
-
signing_key:
|
100
|
+
rubygems_version: 3.4.10
|
101
|
+
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: time with zones
|
104
104
|
test_files: []
|