Module: Sequel::Dataset::RoundTimestamps

Defined in:
lib/sequel/extensions/round_timestamps.rb

Instance Method Summary collapse

Instance Method Details

#literal_datetime(v) ⇒ Object

Round DateTime values before literalizing



32
33
34
# File 'lib/sequel/extensions/round_timestamps.rb', line 32

def literal_datetime(v)
  super(v + Rational(5, 10**timestamp_precision)/864000)
end

#literal_sqltime(v) ⇒ Object

Round Sequel::SQLTime values before literalizing



37
38
39
# File 'lib/sequel/extensions/round_timestamps.rb', line 37

def literal_sqltime(v)
  super(v.round(sqltime_precision))
end

#literal_time(v) ⇒ Object

Round Time values before literalizing



42
43
44
# File 'lib/sequel/extensions/round_timestamps.rb', line 42

def literal_time(v)
  super(v.round(timestamp_precision))
end