Class: SafeYAML::Parse::Date
- Defined in:
- lib/puppet/vendor/safe_yaml_patches.rb,
lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/date.rb
Constant Summary collapse
- DATE_MATCHER =
This one’s easy enough :)
/\A(\d{4})-(\d{2})-(\d{2})\Z/.freeze
- TIME_MATCHER =
This unbelievable little gem is taken basically straight from the YAML spec, but made slightly more readable (to my poor eyes at least) to me: yaml.org/type/timestamp.html
/\A\d{4}-\d{1,2}-\d{1,2}(?:[Tt]|\s+)\d{1,2}:\d{2}:\d{2}(?:\.\d*)?\s*(?:Z|[-+]\d{1,2}(?::?\d{2})?)?\Z/.freeze
- SECONDS_PER_DAY =
60 * 60 * 24
- MICROSECONDS_PER_SECOND =
1000000
- SEC_FRACTION_MULTIPLIER =
So this is weird. In Ruby 1.8.7, the DateTime#sec_fraction method returned fractional seconds in units of DAYS for some reason. In 1.9.2, they changed the units – much more reasonably – to seconds.
RUBY_VERSION == "1.8.7" ? (SECONDS_PER_DAY * MICROSECONDS_PER_SECOND) : MICROSECONDS_PER_SECOND