GeniusTrader/DateTime/Tick.pm

filter: Statementstmt 59.0% 13 / 22 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 53.1% 17 / 32 CC 2 SCAR 9.4
CC
2
Cov
54%
map_date_to_time
6.0
map_time_to_date
2.0
BEGIN
1.0
CRAP 2.6
« GeniusTrader/DateTime/1Min.pm ↑ Summary GeniusTrader/Graphics/Object.pm »
1 package Finance::GeniusTrader::DateTime::Tick;
2  
3 # Copyright 2000-2002 Raphaël Hertzog, Fabien Fulhaber
4 # Copyright 2005 João Antunes Costa
5 # This file is distributed under the terms of the General Public License
6 # version 2 or (at your option) any later version.
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use vars qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Finance::GeniusTrader::DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Time::Local;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =head1 Finance::GeniusTrader::DateTime::Tick
15  
16 This module treat dates describing ticks. They have the following format :
17 YYYY-MM-DD HH:NN:SS
18  
19 =cut
20 0 ▶sub map_date_to_time {
Subroutine map_date_to_time: not called CC=2 SCAR=17.9
Pod undocumented
21 0 my ($value) = @_;
22 0 my ($date, $time) = split / /, $value;
23 0 ▶ $time = '00:00:00' unless (defined($time));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $time 0 0 0
24 0 my ($y, $m, $d) = split /-/, $date;
25 0 my ($h, $n, $s) = split /:/, $time;
26 0 return timelocal($s, $n, $h, $d, $m - 1, $y - 1900);
27 }
28  
29 0 ▶sub map_time_to_date {
Subroutine map_time_to_date: not called CC=1 SCAR=6.9
Pod undocumented
30 0 my ($time) = @_;
31 0 my ($sec, $min, $hour, $d, $m, $y, $wd, $yd) = localtime($time);
32 0 return sprintf("%04d-%02d-%02d %02d:%02d:%02d", $y + 1900, $m + 1, $d, $hour, $min, $sec);
33 }
34  
35 1 1;
« GeniusTrader/DateTime/1Min.pm ↑ Summary GeniusTrader/Graphics/Object.pm »