Class: ThirdBase::DateTime
- Extended by:
- CompatClassMethods, ClassMethods, DateTimeCompatClassMethods
- Defined in:
- lib/third_base/datetime.rb,
lib/third_base/make_compat.rb
Overview
ThirdBase’s DateTime class, which builds on the Date class and adds a time component of hours, minutes, seconds, microseconds, and an offset from UTC.
Direct Known Subclasses
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Constant Summary collapse
- PARSERS =
{}
- UNIXEPOCH =
ThirdBase::Date::UNIXEPOCH
- TIME_ZONE_SECOND_OFFSETS =
{ 'UTC'=>0, 'Z'=>0, 'UT'=>0, 'GMT'=>0, 'EST'=>-18000, 'EDT'=>-14400, 'CST'=>-21600, 'CDT'=>-18000, 'MST'=>-25200, 'MDT'=>-21600, 'PST'=>-28800, 'PDT'=>-25200, 'A'=>3600, 'B'=>7200, 'C'=>10800, 'D'=>14400, 'E'=>18000, 'F'=>21600, 'G'=>25200, 'H'=>28800, 'I'=>32400, 'K'=>36000, 'L'=>39600, 'M'=>43200, 'N'=>-3600, 'O'=>-7200, 'P'=>-10800, 'Q'=>-14400, 'R'=>-18000, 'S'=>-21600, 'T'=>-25200, 'U'=>-28800, 'V'=>-32400, 'W'=>-36000, 'X'=>-39600, 'Y'=>-43200}
- PARSER_LIST =
[]
- DEFAULT_PARSER_LIST =
[:time, :iso, :us, :num]
- DEFAULT_PARSERS =
{}
- TIME_ZONE_RE_STRING =
"(#{TIME_ZONE_SECOND_OFFSETS.keys.sort.join('|')}|[+-](?:\\d\\d:?(?:\\d\\d)?))"
- TIME_RE_STRING =
"(?:[T ]?([\\d ]?\\d):(\\d\\d)(?::(\\d\\d(\\.\\d+)?))?([ap]m?)? ?#{TIME_ZONE_RE_STRING}?)?"
- STRPTIME_PROC_H =
proc{|h,x| h[:hour] = x.to_i}
- STRPTIME_PROC_M =
proc{|h,x| h[:min] = x.to_i}
- STRPTIME_PROC_P =
proc{|h,x| h[:meridian] = x.downcase == 'pm' ? :pm : :am}
- STRPTIME_PROC_S =
proc{|h,x| h[:sec] = x.to_i}
- STRPTIME_PROC_s =
proc do |h,x| j, i = x.to_i.divmod(86400) hours, i = i.divmod(3600) minutes, seconds = i.divmod(60) h.merge!(:jd=>j+UNIXEPOCH, :hour=>hours, :min=>minutes, :sec=>seconds) end
- STRPTIME_PROC_z =
proc{|h,x| h[:offset] = convert_parsed_offset(x)}
Constants inherited from Date
ThirdBase::Date::ABBR_DAYNAMES, ThirdBase::Date::ABBR_DAYNAME_RE_PATTERN, ThirdBase::Date::ABBR_MONTHNAMES, ThirdBase::Date::ABBR_MONTHNAME_RE_PATTERN, ThirdBase::Date::CUMMULATIVE_MONTH_DAYS, ThirdBase::Date::DAYNAMES, ThirdBase::Date::DAYS_IN_MONTH, ThirdBase::Date::DAY_NUM_MAP, ThirdBase::Date::FULL_DAYNAME_RE_PATTERN, ThirdBase::Date::FULL_MONTHNAME_RE_PATTERN, ThirdBase::Date::LEAP_CUMMULATIVE_MONTH_DAYS, ThirdBase::Date::LEAP_DAYS_IN_MONTH, ThirdBase::Date::MONTHNAMES, ThirdBase::Date::MONTHNAME_RE_PATTERN, ThirdBase::Date::MONTH_NUM_MAP, ThirdBase::Date::STRFTIME_RE, ThirdBase::Date::STRPTIME_PROC_A, ThirdBase::Date::STRPTIME_PROC_B, ThirdBase::Date::STRPTIME_PROC_C, ThirdBase::Date::STRPTIME_PROC_G, ThirdBase::Date::STRPTIME_PROC_V, ThirdBase::Date::STRPTIME_PROC_Y, ThirdBase::Date::STRPTIME_PROC_d, ThirdBase::Date::STRPTIME_PROC_g, ThirdBase::Date::STRPTIME_PROC_j, ThirdBase::Date::STRPTIME_PROC_m, ThirdBase::Date::STRPTIME_PROC_u, ThirdBase::Date::STRPTIME_PROC_y
Instance Attribute Summary
Attributes included from InstanceMethods
Method Summary
Methods included from ClassMethods
civil, commercial, jd, jd_fract, now, ordinal
Methods included from CompatClassMethods
_parse, ajd_to_amjd, ajd_to_jd, amjd_to_ajd, civil_to_jd, commercial_to_jd, day_fraction_to_time, gregorian?, jd_to_ajd, jd_to_civil, jd_to_commercial, jd_to_ld, jd_to_mjd, jd_to_ordinal, jd_to_wday, julian?, julian_leap?, ld_to_jd, leap?, mjd_to_jd, ordinal_to_jd, time_to_day_fraction, valid_civil?, valid_commercial?, valid_jd?, valid_ordinal?, valid_time?, zone_to_diff
Methods included from DateTimeCompatClassMethods
_strptime, civil, commercial, jd, now, ordinal, parse, strptime
Methods included from DateTimeCompatInstanceMethods
#asctime, #day_fraction, #new_offset, #offset, #offset_sec, #sec_fraction
Methods included from CompatInstanceMethods
#ajd, #amjd, #gregorian, #gregorian?, #julian?, #ld, #mday, #new_start, #start
Methods included from InstanceMethods
#+, #-, #<=>, #==, #eql?, #fract, #hour, #initialize, #min, #sec, #usec, #zone
Methods included from ThirdBase::Date::ClassMethods
#add_parser, #add_parser_type, #civil, #commercial, #jd, #new, #ordinal, #parse, #reset_parsers!, #strptime, #today, #use_parsers
Methods included from DateCompatClassMethods
#_strptime, #civil, #commercial, #jd, #ordinal, #parse, #strptime, #today
Methods included from DateCompatInstanceMethods
Methods included from ThirdBase::Date::InstanceMethods
#+, #-, #<<, #<=>, #==, #===, #>>, #cwday, #cweek, #cwyear, #day, #downto, #eql?, #hash, #initialize, #inspect, #jd, #leap?, #mon, #step, #strftime, #succ, #to_s, #upto, #wday, #yday, #year