File Coverage

blib/lib/DateTime/TimeZone/Floating.pm
Criterion Covered Total %
statement 12 24 50.0
branch 0 2 0.0
condition 0 3 0.0
subroutine 4 8 50.0
pod 2 3 66.6
total 18 40 45.0


line stmt bran cond sub pod time code
1             package DateTime::TimeZone::Floating;
2              
3 3     3   21 use strict;
  3         6  
  3         83  
4 3     3   19 use warnings;
  3         7  
  3         79  
5 3     3   14 use namespace::autoclean;
  3         6  
  3         15  
6              
7             our $VERSION = '2.58';
8              
9 3     3   1104 use parent 'Class::Singleton', 'DateTime::TimeZone::OffsetOnly';
  3         644  
  3         18  
10              
11             sub new {
12 0     0 1   return shift->instance;
13             }
14              
15             ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
16             sub _new_instance {
17 0     0     my $class = shift;
18              
19 0           return bless {
20             name => 'floating',
21             offset => 0
22             }, $class;
23             }
24             ## use critic
25              
26 0     0 1   sub is_floating {1}
27              
28             sub STORABLE_thaw {
29 0     0 0   my $self = shift;
30              
31 0   0       my $class = ref $self || $self;
32              
33 0           my $obj;
34 0 0         if ( $class->isa(__PACKAGE__) ) {
35 0           $obj = __PACKAGE__->new();
36             }
37             else {
38 0           $obj = $class->new();
39             }
40              
41 0           %$self = %$obj;
42              
43 0           return $self;
44             }
45              
46             1;
47              
48             # ABSTRACT: A time zone that is always local
49              
50             __END__
51              
52             =pod
53              
54             =encoding UTF-8
55              
56             =head1 NAME
57              
58             DateTime::TimeZone::Floating - A time zone that is always local
59              
60             =head1 VERSION
61              
62             version 2.58
63              
64             =head1 SYNOPSIS
65              
66             my $floating_tz = DateTime::TimeZone::Floating->new;
67              
68             =head1 DESCRIPTION
69              
70             This class is used to provide the DateTime::TimeZone API needed by DateTime.pm,
71             but for floating times, as defined by the RFC 2445 spec. A floating time has no
72             time zone, and has an effective offset of zero.
73              
74             =head1 USAGE
75              
76             This class has the same methods as a real time zone object. The
77             C<short_name_for_datetime()> method returns the string "floating" and the
78             C<category()> method returns C<undef>.
79              
80             =head1 SUPPORT
81              
82             Bugs may be submitted at L<https://github.com/houseabsolute/DateTime-TimeZone/issues>.
83              
84             =head1 SOURCE
85              
86             The source code repository for DateTime-TimeZone can be found at L<https://github.com/houseabsolute/DateTime-TimeZone>.
87              
88             =head1 AUTHOR
89              
90             Dave Rolsky <autarch@urth.org>
91              
92             =head1 COPYRIGHT AND LICENSE
93              
94             This software is copyright (c) 2023 by Dave Rolsky.
95              
96             This is free software; you can redistribute it and/or modify it under
97             the same terms as the Perl 5 programming language system itself.
98              
99             The full text of the license can be found in the
100             F<LICENSE> file included with this distribution.
101              
102             =cut