diff options
author | fishsoupisgood <github@madingley.org> | 2018-05-10 11:12:43 +0100 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2018-05-10 11:12:43 +0100 |
commit | 4e46f352f85f2a424bd4990c4a8355d9cceeb4d9 (patch) | |
tree | 42ad0c3ed5edc85d067b53e92deea92a85461cc0 | |
parent | 862036f60497d22a75a5520f286cddece267a72f (diff) | |
download | meteotime-4e46f352f85f2a424bd4990c4a8355d9cceeb4d9.tar.gz meteotime-4e46f352f85f2a424bd4990c4a8355d9cceeb4d9.tar.bz2 meteotime-4e46f352f85f2a424bd4990c4a8355d9cceeb4d9.zip |
only decode if the minuite is right
-rwxr-xr-x | decode.pl | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -714,8 +714,6 @@ for ( my $i = 0 ; $i < ( $n - 2 ) ; ++$i ) { my ( $data_bits, $key_bits ) = extract( $d->[$i], $d->[ $i + 1 ], $d->[ $i + 2 ] ); - my $plain = decrypt( $data_bits, $key_bits ); - next unless defined($plain); my $min = le_bcd_to_int( substr( $key_bits, 0, 8 ) ); my $hour = le_bcd_to_int( substr( $key_bits, 8, 8 ) ); @@ -726,6 +724,12 @@ for ( my $i = 0 ; $i < ( $n - 2 ) ; ++$i ) { my $mins_since_midnight = $min + ( $hour * 60 ); + next unless ( $mins_since_midnight %3) == 2; + + my $plain = decrypt( $data_bits, $key_bits ); + + next unless defined $plain ; + my $dt = DateTime->new( year => $year, month => $month, |