Module: TimeFunctions
Instance Method Summary collapse
- #as_minutes ⇒ Object
- #hm ⇒ Object
- #in_hundredths ⇒ Object
-
#in_hundredths_rounded_xos ⇒ Object
xos is rounding XOJET STYLE, which is a funky copy of how ipc did it.
-
#in_tenths_rounded_xos ⇒ Object
xos is rounding XOJET STYLE, which is a funky copy of how ipc did it.
- #to_fos_days ⇒ Object
Instance Method Details
#as_minutes ⇒ Object
32 33 34 |
# File 'lib/sequel/fos_dates.rb', line 32 def as_minutes hour*60 + min end |
#hm ⇒ Object
59 60 61 |
# File 'lib/sequel/fos_dates.rb', line 59 def hm strftime("%H:%M") end |
#in_hundredths ⇒ Object
36 37 38 39 40 41 |
# File 'lib/sequel/fos_dates.rb', line 36 def in_hundredths return 0 if hour + min == 0 minutes = hour*60 + min val = "#{minutes/60}.#{((100*(minutes.modulo(60)))/60).to_s.rjust(2, '0')}" BigDecimal.new(val, 2).round(2).to_f end |
#in_hundredths_rounded_xos ⇒ Object
xos is rounding XOJET STYLE, which is a funky copy of how ipc did it
44 45 46 47 48 49 |
# File 'lib/sequel/fos_dates.rb', line 44 def in_hundredths_rounded_xos return 0 if hour + min == 0 # It was determined that "ODD" increments of .05 (ie .15, .35, .55, .75, .95) of an hour (ie. 9,21,33,45,57 minutes) rounded UP whereas even increments of .05 rounded DOWN - sn minutes = as_minutes (minutes/60.0 + ([9, 21, 33, 45, 57].include?(min) ? 0.001 : -0.001)).round(2) end |
#in_tenths_rounded_xos ⇒ Object
xos is rounding XOJET STYLE, which is a funky copy of how ipc did it
52 53 54 55 56 57 |
# File 'lib/sequel/fos_dates.rb', line 52 def in_tenths_rounded_xos return 0 if hour + min == 0 # It was determined that "ODD" increments of .05 (ie .15, .35, .55, .75, .95) of an hour (ie. 9,21,33,45,57 minutes) rounded UP whereas even increments of .05 rounded DOWN - sn minutes = as_minutes (minutes/60.0 + ([9, 21, 33, 45, 57].include?(min) ? 0.01 : -0.01)).round(1) end |
#to_fos_days ⇒ Object
63 64 65 |
# File 'lib/sequel/fos_dates.rb', line 63 def to_fos_days to_date.to_fos_days end |