Please ignore the last one... I biffed it too.  Below is the corrected
POD.

                  -ben

=head3 How small an increment of time can I represent?

A<DateTime> can represent nanoseconds.  You can create obects with
that resolution using the C<nanosecond> parameter to C<new> or C<set>
and there is a corresponding C<nanosecond> accessor.  For these you
give an integer count of the nanoseconds.

A millisecond is a thousandth of a second (10^-3 or 0.001).  The
abbreviation is I<ms>.
A microsecond is a millionth of a second (10^-6 or 0.000001).  The
abbreviation is I<us> (or more properly I<E<micro>s>).
A nanosecond is a billionth (US) of a second (10^-9 or 0.000000001).
The abbreviation is I<ns>.

=for example begin

  # The ns part is 0.000000230 below
  my $dt_ns = DateTime->new(year => 2003, month => 3,   day => 1,
                            hour => 6,    minute => 55, second => 23,
                            nanosecond => 230);
  print "ns: ", $dt_ns->nanosecond, "\n";  # Prints: "ns: 230\n"

  # Assuming we got milliseconds as an argument
  my $ms = 42;
  my $dt_ms = DateTime->new(year => 2003, month => 3,   day => 1,
                            hour => 6,    minute => 55, second => 23,
                            nanosecond => $ms * 1_000_000);
  print "ns: ", $dt_ms->nanosecond, "\n";  # Prints: "ns: 42000000\n"



=for example end

=for example_testing
  is($_STDOUT_, "ns: 230\nns: 42000000\n", "Nanoseconds");

Reply via email to