> >      # Because epoch may come from Time::HiRes
> >      my $fraction = $p{epoch} - int( $p{epoch} );
> > -    $args{nanosecond} = $fraction * MAX_NANOSECONDS
> > +    $args{nanosecond} = int( $fraction * MAX_NANOSECONDS )
> >          if $fraction;
>
> What's this for?  I think it was working as is.

Otherwise you will most likely get a fractional result.

> >
> >  # use scalar time in case someone's loaded Time::Piece
> > -sub now { shift->from_epoch( epoch => (scalar time), @_ ) }
> > +sub now { shift->from_epoch( epoch => Time::HiRes::time, @_ ) }
>
> Yep, looks right

The comment should be removed too.

> > I'm not sure exactly how to test this.  Call now times several times in
> > a row and make that one of the results is non-zero for nanoseconds?
>
> Yeah, I don't know a good solid way to test this either.  Maybe override
> Time::HiRes::time() in the test?

We could try it.  Will that confuse AUTOLOAD?

-J

--

Reply via email to