On Wednesday, June 11, 2003, at 07:08 PM, Ben Bennett wrote:
I added a section on nanoseconds:
The raw POD is below.


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

A<DateTime> can represent nanoseconds. You can create obects with

=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
                      ^^^^^
I think you meant:    milli

  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"
^^
That number is in nanoseconds (42 milliseconds is 42,000,000 nanoseconds); does it make sense to label it 'ms' in the test output?


- Bruce

__bruce__van_allen__santa_cruz__ca__



Reply via email to