I added a section on nanoseconds:

http://www.limey.net/~fiji/perl/faq.html#2.9%3A%20How%20small%20an%20increment%20of%20time%20can%20I%20represent%3F

The raw POD is below.

I deliberately did not mention fractional_second since Dave suggests
that it is going away...  If this is not true, please let me know and
I will add info on it.

               -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 microseconds 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 "ms: ", $dt_ms->nanosecond, "\n";  # Prints: "ms: 42000000\n"



=for example end

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

Reply via email to