class ActiveSupport::TimeWithZone

Public Instance Methods

to_api_decimal() click to toggle source

Seconds as BigDecimal with precision to microseconds @return [BigDecimal]

# File lib/gb_date/time_with_zone.rb, line 13
def to_api_decimal
  BigDecimal.new("#{self.to_i}.#{sprintf('%06d',self.nsec/1000)}")
end
to_api_f() click to toggle source

Seconds as Float with precision to microseconds @return [BigDecimal]

# File lib/gb_date/time_with_zone.rb, line 19
def to_api_f
  self.to_api_decimal.to_f
end
to_api_s() click to toggle source

Return string with date represented by seconds with precision to microseconds @return [String]

# File lib/gb_date/time_with_zone.rb, line 25
def to_api_s
  sprintf('%.6f', self.to_api_decimal)
end
to_decimal() click to toggle source

Seconds as BigDecimal With precision to nanoseconds @return [BigDecimal]

# File lib/gb_date/time_with_zone.rb, line 7
def to_decimal
  BigDecimal.new("#{self.to_i}.#{sprintf('%09d',self.nsec)}")
end