class CF::Date

Wrapper for CFDateRef

Public Class Methods

from_time(time) click to toggle source

constructs a CF::Date from a ruby time

@param [Time] time @return [CF::Date] a CF::Date instance that will be released on garbage collection

# File lib/corefoundation/date.rb, line 19
def self.from_time(time)
  new(CF.CFDateCreate(nil, time.to_f - CF.kCFAbsoluteTimeIntervalSince1970))
end

Public Instance Methods

to_ruby()
Alias for: to_time
to_time() click to toggle source

returns a ruby Time instance corresponding to the same point in time

@return [Time]

# File lib/corefoundation/date.rb, line 26
def to_time
  Time.at(CF.CFDateGetAbsoluteTime(self) + CF.kCFAbsoluteTimeIntervalSince1970)
end
Also aliased as: to_ruby