lib/et-orbi/time.rb in et-orbi-1.2.7 vs lib/et-orbi/time.rb in et-orbi-1.2.8

- old
+ new

@@ -99,10 +99,12 @@ end def zone=(z) @time = nil + @ref = nil + @zone = self.class.get_tzone(zone || :current) end # Returns true if this EoTime instance corresponds to 2 different UTC # times. @@ -328,19 +330,25 @@ [ count_weeks(EtOrbi.make_time(strftime('%F 12:00:00 %/Z')), -1), - count_weeks(EtOrbi.make_time(strftime('%F 12:00:00 %/Z')) , 1) ] end + # "reference week", used in fugit for cron modulo notation + # def rweek - ((self - EtOrbi.make_time('2019-01-01 00:00:00', @zone)) / WEEK_S) - .floor + 1 + @ref ||= EtOrbi.make_time('2019-01-01 00:00:00', @zone) + + ((self - @ref) / WEEK_S).floor + 1 end + # "reference week", used in fugit for cron modulo notation + # def rday - ((self - EtOrbi.make_time('2019-01-01 00:00:00', @zone)) / DAY_S) - .floor + 1 + @ref ||= EtOrbi.make_time('2019-01-01 00:00:00', @zone) + + ((self - @ref) / DAY_S).floor + 1 end def reach(points) t = EoTime.new(self.to_f, @zone)