class Puppet::Pops::Time::Timespan::Format::NanoSecondSegment

Public Class Methods

new(padchar, width) click to toggle source
    # File lib/puppet/pops/time/timespan.rb
514 def initialize(padchar, width)
515   super(padchar, width, 9)
516 end

Public Instance Methods

append_to(bld, ts) click to toggle source
    # File lib/puppet/pops/time/timespan.rb
527 def append_to(bld, ts)
528   ns = ts.total_nanoseconds
529   width = @width || @default_width
530   if width < 9
531     # Truncate digits to the right, i.e. let %6N reflect microseconds
532     ns /= 10 ** (9 - width)
533     ns %= 10 ** width unless use_total?
534   else
535     ns %= NSECS_PER_SEC unless use_total?
536   end
537   append_value(bld, ns)
538 end
multiplier() click to toggle source
    # File lib/puppet/pops/time/timespan.rb
518 def multiplier
519   width = @width || @default_width
520   if width < 9
521     10 ** (9 - width)
522   else
523     1
524   end
525 end