Module: ThirdBase::DateTimeCompatInstanceMethods

Included in:
DateTime
Defined in:
lib/third_base/make_compat.rb

Instance Method Summary collapse

Instance Method Details

#asctimeObject Also known as: ctime

Returns a formatted string representing the date.



366
367
368
# File 'lib/third_base/make_compat.rb', line 366

def asctime
  strftime('%c')
end

#day_fractionObject



371
372
373
# File 'lib/third_base/make_compat.rb', line 371

def day_fraction
  fract
end

#new_offset(offset = 0) ⇒ Object Also known as: newof

Returns a new DateTime with the same date and time as this datetime, but with a new offset.



376
377
378
# File 'lib/third_base/make_compat.rb', line 376

def new_offset(offset=0)
  self.class.new!(:civil=>civil, :parts=>time_parts, :offset=>(offset*86400).to_i)
end

#offsetObject Also known as: of

Return the offset as a Float representing the fraction of the day different from UTC.



382
383
384
# File 'lib/third_base/make_compat.rb', line 382

def offset
  @offset/86400.0
end

#offset_secObject

Return the offset as a number of seconds from UTC.



388
389
390
# File 'lib/third_base/make_compat.rb', line 388

def offset_sec
  @offset
end

#sec_fractionObject

The fraction of a second represented as a fraction of the entire day.



393
394
395
# File 'lib/third_base/make_compat.rb', line 393

def sec_fraction
  usec/86400000000.0
end