- CLASS METHODS
- COPYRIGHT AND LICENSE
Net::Analysis::Time - value object for [tv_sec, tv_usec] times
use Net::Analysis::Time; my $t1 = Net::Analysis::Time->new(10812345, 123456); my $t2 = Net::Analysis::Time->new(10812356, 123456); my $diff = $t2-$t1; # == new Time Object print "$diff\n"; # == "11.000000" $t1->round_usec(10000); # "$t1" == "10812345.120000";
Can't believe I've found myself implementing a date/time module. The shame of it.
This is a heavily overloaded object, so '+', '-' do what you expect.
There is some format stuff to change how it stringfies, and some stuff for rounding off values, used elsewhere for time-boxing.
This stuff should probably all be junked as soon as someone wants some efficiency.
If passed a single floating point arg, does what it can, but don't blame me if rounding errors knacker things up.
Best to pass two ints, one seconds and one microseconds.
Returns a new object, holding the same time value as the invocant.
Rounds the time down to the nearest usec_step value. Valid values between 10 and 1000000. A value of 1000000 will round to the nearest second.
Optional argument, if true, causes rounding to go up, not down.
Set the default output format for stringification of the date/time. The parameter is either a
strftime(3) compliant string, or a named format:
raw - 1100257189.123456 time - 10:59:49.123456 full - 2004/11/12 10:59:49.123456
Returns the old format.
None by default.
Adam B. Worrall, <email@example.com>
Copyright (C) 2004 by Adam B. Worrall
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.