Debian Codegraph @

lib/DateTime/TimeZone/Floating.pm

raw
1 package DateTime::TimeZone::Floating;
2
3 use strict;
4 use warnings;
5 use namespace::autoclean;
6
7 our $VERSION = '2.70';
8
9 use parent 'Class::Singleton', 'DateTime::TimeZone::OffsetOnly';
10
11 sub new {
12 return shift->instance;
13 }
14
15 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
16 sub _new_instance {
17 my $class = shift;
18
19 return bless {
20 name => 'floating',
21 offset => 0
22 }, $class;
23 }
24 ## use critic
25
26 sub is_floating {1}
27
28 sub STORABLE_thaw {
29 my $self = shift;
30
31 my $class = ref $self || $self;
32
33 my $obj;
34 if ( $class->isa(__PACKAGE__) ) {
35 $obj = __PACKAGE__->new();
36 }
37 else {
38 $obj = $class->new();
39 }
40
41 %$self = %$obj;
42
43 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.70
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 <[email protected]>
91
92 =head1 COPYRIGHT AND LICENSE
93
94 This software is copyright (c) 2026 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