lib/SMB/Time.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 86.6% 26 / 30 SCAR 11.0
CC
3
Cov
90%
from_nttime
2.1
to_nttime
2.1
BEGIN
1.0
CRAP 3.0
« blib/lib/SMB/v1/Header.pm ↑ Summary blib/lib/SMB/Header.pm »
1 # SMB-Perl library, Copyright (C) 2014 Mikhael Goikhman, migo@cpan.org
2 #
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15  
16 package SMB::Time;
17  
18 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 # bigint conflicts with Time::HiRes::time, prefer to lose precision for now
22 #use if (1 << 32 == 1), 'bigint'; # support native uint64 on 32-bit platforms
23  
24 5 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
25 5 our @EXPORT = qw(from_nttime to_nttime);
26  
27 5 my $nttime_factor = 10_000_000;
28 5 my $nttime_offset = 11_644_473_600;
29  
30 sub from_nttime ($) {
31 2 ▶ my $nttime = shift || return 0;
Subroutine from_nttime: called CC=2 SCAR=7.2
Pod documented
Condition50%1/2
shift() || (return 0)
l!l
20
MC/DC0%0/1
shift() || (return 0)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
32  
33 2 return $nttime / $nttime_factor - $nttime_offset;
34 }
35  
36 sub to_nttime ($) {
37 34 ▶ my $time = shift || return 0;
Subroutine to_nttime: called CC=2 SCAR=7.2
Pod documented
Condition50%1/2
shift() || (return 0)
l!l
340
MC/DC0%0/1
shift() || (return 0)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
38  
39 34 return ($time + $nttime_offset) * $nttime_factor;
40 }
41  
42 5 1;
43  
44 __END__
« blib/lib/SMB/v1/Header.pm ↑ Summary blib/lib/SMB/Header.pm »