Method: TZInfo::TimeOrDateTime#usec

Defined in:
lib/tzinfo/time_or_datetime.rb

#usecObject

Returns the number of microseconds for the time.



191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/tzinfo/time_or_datetime.rb', line 191

def usec      
  if @time
    @time.usec
  elsif @datetime
    # Ruby 1.8 has sec_fraction (of which the documentation says
    # 'I do NOT recommend you to use this method'). sec_fraction no longer
    # exists in Ruby 1.9.
    
    # Calculate the sec_fraction from the day_fraction.
    ((@datetime.day_fraction - OffsetRationals.rational_for_offset(@datetime.hour * 3600 + @datetime.min * 60 + @datetime.sec)) * 86400000000).to_i
  else 
    0
  end
end