in reply to A billion seconds of Unix

Dunce::time may or may not fix 10digit time problem. See also that.

--
Tatsuhiko Miyagawa
miyagawa@cpan.org

Replies are listed 'Best First'.
Re: Re: A billion seconds of Unix
by blakem (Monsignor) on Sep 07, 2001 at 22:11 UTC
    Thats a good link.... timestamps will no longer sort correctly when they are 'cmp'ed instead of '<=>'ed. ((10 cmp 9)  != (10 <=> 9)) I had only considered the extra-digit issue, but sorting is probably a bigger problem since 'cmp' is the default and it worked fine in the past.
    #!/usr/bin/perl -wT use strict; my @a = (5..15); print "cmp comparison of 9 and 10: ", 10 cmp 9, "\n"; print "<=> comparison of 9 and 10: ", 10 <=> 9, "\n"; print "\n"; print "cmp sort of 5..15: ", join(' ',(sort @a)), "\n"; print "<=> sort of 5..15: ", join(' ',(sort {$a<=>$b} @a)), "\n"; =output cmp comparison of 9 and 10: -1 <=> comparison of 9 and 10: 1 cmp sort of 5..15: 10 11 12 13 14 15 5 6 7 8 9 <=> sort of 5..15: 5 6 7 8 9 10 11 12 13 14 15

    -Blake