Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
time returns Num instead of Int (like niecza)
  • Loading branch information
FROGGS committed Aug 31, 2012
1 parent 81d488a commit 388b017
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions S32-temporal/DateTime.t
Expand Up @@ -21,7 +21,8 @@ sub show-dt($dt) {
} }


# An independent calculation to cross check the Temporal algorithms. # An independent calculation to cross check the Temporal algorithms.
sub test-gmtime( Int $t is copy ) { multi sub test-gmtime( Num $t ) { test-gmtime( $t.Int ) }
multi sub test-gmtime( Int $t is copy ) {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday);
$sec = $t % 60; $t div= 60; # $t is now epoch minutes $sec = $t % 60; $t div= 60; # $t is now epoch minutes
$min = $t % 60; $t div= 60; # $t is now epoch hours $min = $t % 60; $t div= 60; # $t is now epoch hours
Expand Down Expand Up @@ -50,7 +51,7 @@ sub test-gmtime( Int $t is copy ) {
# L<S32::Temporal/C<time>> # L<S32::Temporal/C<time>>
# -------------------------------------------------------------------- # --------------------------------------------------------------------


isa_ok time, Int, 'time returns an Int'; isa_ok time, Num, 'time returns a Num';


# -------------------------------------------------------------------- # --------------------------------------------------------------------
# L<S32::Temporal/C<DateTime>/immutable> # L<S32::Temporal/C<DateTime>/immutable>
Expand Down Expand Up @@ -270,7 +271,7 @@ is DateTime.new('2009-12-31T22:33:44',
$dt = dt $dt = dt
year => @t[5], month => @t[4], day => @t[3], year => @t[5], month => @t[4], day => @t[3],
hour => @t[2], minute => @t[1], second => @t[0]; hour => @t[2], minute => @t[1], second => @t[0];
is $dt.posix, $t, "at $dt, POSIX is {$dt.posix}"; is $dt.posix, $t.Int, "at $dt, POSIX is {$dt.posix}";
} }


# -------------------------------------------------------------------- # --------------------------------------------------------------------
Expand Down

0 comments on commit 388b017

Please sign in to comment.