Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / Date::Calendar.3
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "CALENDAR 1"
132.TH CALENDAR 1 "2002-09-28" "perl v5.8.0" "User Contributed Perl Documentation"
133.SH "NAME"
134Date::Calendar \- Calendar objects for different holiday schemes
135.SH "MOTTO"
136.IX Header "MOTTO"
137There is more than one way to do it \- this is just one of them!
138.SH "PREFACE"
139.IX Header "PREFACE"
140Basically, Date::Calendar is just a caching proxy class for
141Date::Calendar::Year objects, which are embedded in each
142Date::Calendar object.
143.PP
144However, and in contrast to Date::Calendar::Year methods, Date::Calendar
145methods permit calculations spanning an arbitrary number of years, without
146loss of efficiency.
147.PP
148So you should usually use Date::Calendar and not Date::Calendar::Year,
149since that way you don't have to worry about calculations crossing year
150boundaries.
151.PP
152Note however that Date::Calendar and Date::Calendar::Year can only deal
153with years lying within the range [1583..2299].
154.SH "SYNOPSIS"
155.IX Header "SYNOPSIS"
156.Vb 2
157\& use Date::Calendar::Profiles qw( $Profiles );
158\& use Date::Calendar;
159.Ve
160.PP
161.Vb 2
162\& $calendar_US_AZ = Date::Calendar->new( $Profiles->{'US-AZ'} [,LANG] );
163\& $calendar_DE_SN = Date::Calendar->new( $Profiles->{'DE-SN'} [,LANG] );
164.Ve
165.PP
166.Vb 2
167\& $year_2000_US_AZ = $calendar_US_AZ->year( 2000 );
168\& $year_2001_DE_SN = $calendar_DE_SN->year( 2001 );
169.Ve
170.PP
171.Vb 2
172\& @years = $calendar->cache_keys(); # returns list of year numbers
173\& @years = $calendar->cache_vals(); # returns list of year objects
174.Ve
175.PP
176.Vb 3
177\& $calendar->cache_clr();
178\& $calendar->cache_add(YEAR|DATE,...);
179\& $calendar->cache_del(YEAR|DATE,...);
180.Ve
181.PP
182.Vb 1
183\& $index = $calendar->date2index(YEAR,MONTH,DAY|DATE);
184.Ve
185.PP
186.Vb 3
187\& @names = $calendar->labels(YEAR,MONTH,DAY|DATE);
188\& @holidays = $calendar->labels();
189\& $holidays = $calendar->labels();
190.Ve
191.PP
192.Vb 2
193\& @dates = $calendar->search(PATTERN);
194\& $dates = $calendar->search(PATTERN);
195.Ve
196.PP
197.Vb 3
198\& $days = $calendar->delta_workdays(YEAR1,MONTH1,DAY1|DATE1
199\& ,YEAR2,MONTH2,DAY2|DATE2
200\& ,FLAG1,FLAG2);
201.Ve
202.PP
203.Vb 4
204\& ($date,$rest) = $calendar->add_delta_workdays(YEAR,MONTH,DAY|DATE
205\& ,DELTA);
206\& $date = $calendar->add_delta_workdays(YEAR,MONTH,DAY|DATE
207\& ,DELTA);
208.Ve
209.PP
210.Vb 3
211\& $flag = $calendar->is_full(YEAR,MONTH,DAY|DATE);
212\& $flag = $calendar->is_half(YEAR,MONTH,DAY|DATE);
213\& $flag = $calendar->is_work(YEAR,MONTH,DAY|DATE);
214.Ve
215.SH "INTERFACE"
216.IX Header "INTERFACE"
217Note that whenever a year number, a date, a time or a combined
218date and time are expected as input parameters by one of the
219methods of this class, you can always pass a Date::Calc[::Object]
220date object or an array reference (of an array of appropriate
221length) instead!
222.PP
223See \fIDate::Calc::Object\fR\|(3) for more details.
224.PP
225So instead of calling a given method like this:
226.PP
227.Vb 3
228\& $object->method1( $year,$month,$day );
229\& $object->method2( $year1,$month1,$day1, $year2,$month2,$day2 );
230\& $object->method3( $year1, $year2, $year3 );
231.Ve
232.PP
233You can also call it like so:
234.PP
235.Vb 2
236\& $object->method1( $date );
237\& $object->method1( [1964,1,3] );
238.Ve
239.PP
240.Vb 8
241\& $object->method2( $year1,$month1,$day1, $date2 );
242\& $object->method2( $date1, $year2,$month2,$day2 );
243\& $object->method2( $date1, $date2 );
244\& $object->method2( $year1,$month1,$day1, [2001,3,17] );
245\& $object->method2( [1964,1,3], $year2,$month2,$day2 );
246\& $object->method2( [1964,1,3], [2001,3,17] );
247\& $object->method2( $date1, [2001,3,17] );
248\& $object->method2( [1964,1,3], $date2 );
249.Ve
250.PP
251.Vb 1
252\& $object->method3( $year1, $date2, [2001,3,17] );
253.Ve
254.PP
255And similarly if a time or a combined date and time are expected.
256.PP
257If you substitute an expected year number by an anonymous array
258(this is the recommended way of writing date constants, for
259increased readability of your programs), it must contain three
260values, nevertheless (otherwise the use of an anonymous array
261would be pointless).
262.PP
263Don't confuse year numbers and their substitutes (a date object
264or an array reference) with Date::Calendar::Year objects, which
265are a totally different thing!
266.PP
267But incidentally \f(CW\*(C`:\-)\*(C'\fR, you may also pass a Date::Calendar::Year
268object whenever a year number is expected. However, and perhaps
269against your expectations at times, especially in conjunction
270with the method \*(L"\fIcache_add()\fR\*(R", only the year number from that
271object will be used, not the year object itself (the year
272object in question might be using the wrong profile!).
273.PP
274Moreover, whenever a method of this class returns a date, it
275does so by returning a Date::Calc[::Object] date object.
276.SH "DESCRIPTION"
277.IX Header "DESCRIPTION"
278.IP "\(bu" 2
279\&\f(CW\*(C`$calendar = Date::Calendar\->new(PROFILE[,LANG]);\*(C'\fR
280.Sp
281The first argument must be the reference of a hash,
282which contains a holiday scheme or \*(L"profile\*(R" to be used
283in all calculations involving the new calendar object.
284.Sp
285The second argument is optional, and must consist of
286the valid name or number of a language as provided by
287the \fIDate::Calc\fR\|(3) module if given.
288.Sp
289See \fIDate::Calendar::Profiles\fR\|(3) and \fIDate::Calendar::Year\fR\|(3)
290for more details about these arguments and about how
291to roll your own calendar profiles.
292.Sp
293The method creates a new calendar object for a given profile,
294i.e., a given location and its scheme of holidays (or a scheme
295of your own).
296.Sp
297This calendar object is a caching proxy object; it stores the
298reference of the given profile and contains a hash (the cache)
299of Date::Calendar::Year objects.
300.IP "\(bu" 2
301\&\f(CW\*(C`$year = $calendar\->year(YEAR|DATE);\*(C'\fR
302.Sp
303This method returns a Date::Calendar::Year object for the given
304year and the profile that was associated with the given calendar
305object.
306.Sp
307If the cache in the given calendar object already contains an
308object for the requested year, the corresponding object reference
309is simply returned.
310.Sp
311If not, a new Date::Calendar::Year object is created using the
312profile that has been associated with the given calendar object.
313The new Date::Calendar::Year object is then stored in the calendar
314object's cache and its object reference is returned.
315.Sp
316A fatal \*(L"given year out of range\*(R" error will occur if the given
317year number lies outside the valid range of [1583..2299].
318.IP "\(bu" 2
319\&\f(CW\*(C`@years = $calendar\->cache_keys();\*(C'\fR
320.Sp
321This method returns the list of \fB\s-1YEAR\s0 \s-1NUMBERS\s0\fR of the
322Date::Calendar::Year objects contained in the given
323calendar object's cache.
324.IP "\(bu" 2
325\&\f(CW\*(C`@years = $calendar\->cache_vals();\*(C'\fR
326.Sp
327This method returns the list of \fB\s-1OBJECT\s0 \s-1REFERENCES\s0\fR of
328the Date::Calendar::Year objects contained in the given
329calendar object's cache.
330.IP "\(bu" 2
331\&\f(CW\*(C`$calendar\->cache_clr();\*(C'\fR
332.Sp
333This method clears the entire cache of the given calendar
334object (by destroying the cache hash and creating a new one).
335.IP "\(bu" 2
336\&\f(CW\*(C`$calendar\->cache_add(YEAR|DATE,...);\*(C'\fR
337.Sp
338Roughly, this method is a shortcut for
339.Sp
340.Vb 4
341\& for $year (@list)
342\& {
343\& $calendar->year($year);
344\& }
345.Ve
346.IP "\(bu" 2
347\&\f(CW\*(C`$calendar\->cache_del(YEAR|DATE,...);\*(C'\fR
348.Sp
349This method removes the Date::Calendar::Year objects whose
350year numbers are given from the cache of the given calendar
351object.
352.Sp
353Year numbers for which the calendar object's cache doesn't
354contain an entry are simply ignored.
355.IP "\(bu" 2
356\&\f(CW\*(C`$index = $calendar\->date2index(YEAR,MONTH,DAY|DATE);\*(C'\fR
357.Sp
358This method converts a given date into the number of the day in
359that year (this is sometimes also referred to as the \*(L"julian\*(R"
360date), i.e., a number between 0 (for January 1st) and the number
361of days in the given year minus one, i.e., 364 or 365 (for
362December 31st).
363.Sp
364You may need this in order to access the bit vectors returned
365by the Date::Calendar::Year methods \*(L"\fIvec_full()\fR\*(R", \*(L"\fIvec_half()\fR\*(R"
366and \*(L"\fIvec_work()\fR\*(R".
367.Sp
368If the Date::Calendar::Year object for the given \s-1YEAR\s0 is not in
369the \f(CW$calendar\fR's cache yet, it will be created and added.
370.Sp
371An exception (\*(L"invalid date\*(R") is thrown if the given arguments
372do not constitute a valid date, or (\*(L"given year out of range
373[1583..2299]\*(R") if the given year lies outside of the permitted
374range.
375.IP "\(bu" 2
376\&\f(CW\*(C`@names = $calendar\->labels(YEAR,MONTH,DAY|DATE);\*(C'\fR
377.Sp
378\&\f(CW\*(C`@holidays = $calendar\->labels();\*(C'\fR
379.Sp
380\&\f(CW\*(C`$holidays = $calendar\->labels();\*(C'\fR
381.Sp
382If any arguments are given, they are supposed to represent a
383date. In that case, a list of all labels (= names of holidays)
384associated with that date are returned. The first item returned
385is always the name of the day of week for that date. The
386corresponding year object for the given date's year is
387added to the calendar's cache first if necessary.
388.Sp
389If no arguments are given, the list of all available labels in
390all years that have previously been accessed in the given calendar
391(i.e., the years which are already in the given calendar's cache)
392is constructed. Note that this means that the returned list will
393be empty if there are no year objects in the given calendar's
394cache yet (!). The returned list does \fB\s-1NOT\s0\fR include any names
395of the days of week (which would be pointless in this case).
396.Sp
397Multiple labels are reported only once.
398.Sp
399Usually all years have the same set of labels, so it may seem
400superfluous to scan all the years in the cache instead of just
401one. But there may be exceptions, because it is possible to
402define calendar profiles which do not contain all possible
403holidays in every year. See \fIDate::Calendar::Profiles\fR\|(3)
404and \fIDate::Calendar::Year\fR\|(3) for more details.
405.Sp
406In list context, the resulting list itself is returned. In scalar
407context, the number of items in the resulting list is returned.
408.IP "\(bu" 2
409\&\f(CW\*(C`@dates = $calendar\->search(PATTERN);\*(C'\fR
410.Sp
411\&\f(CW\*(C`$dates = $calendar\->search(PATTERN);\*(C'\fR
412.Sp
413This method searches through all the labels in all years that
414have previously been accessed in the given calendar (i.e., the
415years which are already in the given calendar's cache) and
416returns a list of date objects with all dates whose labels
417match the given pattern.
418.Sp
419(Use the methods \*(L"\fIcache_clr()\fR\*(R", \*(L"\fIcache_add()\fR\*(R" and \*(L"\fIcache_del()\fR\*(R"
420in order to put the year numbers you want into the calendar
421object's cache, or to make sure it only contains the year
422numbers you want to search.)
423.Sp
424Note that this is a simple, case-insensitive substring search,
425\&\fB\s-1NOT\s0\fR a full-fledged regular expression search!
426.Sp
427The result is guaranteed to be sorted chronologically.
428.Sp
429In scalar context, only the number of items in the resulting list
430is returned, instead of the resulting list itself (as in list context).
431.IP "\(bu" 2
432\&\f(CW\*(C`$days = $calendar\->delta_workdays(YEAR1,MONTH1,DAY1, YEAR2,MONTH2,DAY2, FLAG1,FLAG2);\*(C'\fR
433.Sp
434\&\f(CW\*(C`$days = $calendar\->delta_workdays(DATE1,DATE2,FLAG1,FLAG2);\*(C'\fR
435.Sp
436This method calculates the number of work days (i.e., the number
437of days, but excluding all holidays) between two dates.
438.Sp
439In other words, this method is equivalent to the \*(L"\fIDelta_Days()\fR\*(R"
440function of the Date::Calc module, except that it disregards
441holidays in its counting.
442.Sp
443The two flags indicate whether the start and end dates should be
444included in the counting (that is, of course, only in case they
445aren't holidays), or not.
446.Sp
447It is common, for example, that you want to know how many work
448days are left between the current date and a given deadline.
449.Sp
450Typically, you will want to count the current date but not the
451deadline's date. So you would specify \*(L"true\*(R" (\*(L"1\*(R") for \s-1FLAG1\s0
452and \*(L"false\*(R" (\*(L"0\*(R") for \s-1FLAG2\s0 in order to achieve that.
453.Sp
454In other words, a value of \*(L"true\*(R" means \*(L"including this date\*(R",
455a value of \*(L"false\*(R" means \*(L"excluding this date\*(R".
456.Sp
457As with the \*(L"\fIDelta_Days()\fR\*(R" function from the Date::Calc module,
458the dates have to be given in chronological order to yield a
459positive result. If the dates are reversed, the result will
460be negative.
461.Sp
462The parameter \s-1FLAG1\s0 is associated with the first given date,
463the parameter \s-1FLAG2\s0 with the second given date (regardless
464of whether the dates are in chronological order or not).
465.Sp
466An exception (\*(L"invalid date\*(R") is raised if either of the two
467date arguments does not constitute a valid date.
468.IP "\(bu" 2
469\&\f(CW\*(C`($date,$rest) = $calendar\->add_delta_workdays(YEAR,MONTH,DAY, DELTA);\*(C'\fR
470.Sp
471\&\f(CW\*(C`($date,$rest) = $calendar\->add_delta_workdays(DATE,DELTA);\*(C'\fR
472.Sp
473\&\f(CW\*(C`$date = $calendar\->add_delta_workdays(YEAR,MONTH,DAY, DELTA);\*(C'\fR
474.Sp
475\&\f(CW\*(C`$date = $calendar\->add_delta_workdays(DATE,DELTA);\*(C'\fR
476.Sp
477This method is the equivalent of the \*(L"\fIAdd_Delta_Days()\fR\*(R" function
478from the Date::Calc module, except that it adds work days and
479skips holidays.
480.Sp
481In other words, you can add or subtract a number of work days
482\&\*(L"\s-1DELTA\s0\*(R" to/from a given date and get a new date as the result
483(as a Date::Calc object).
484.Sp
485You add days (i.e., you go forward in time) with a positive
486offset \*(L"\s-1DELTA\s0\*(R", and you subtract days (i.e., you go backwards
487in time) with a negative offset.
488.Sp
489Note that an exception (\*(L"invalid date\*(R") is raised if the
490given date argument does not constitute a valid date.
491.Sp
492In scalar context, the method just returns the resulting date
493object, whereas in list context the method not only returns the
494new date, but also a \*(L"rest\*(R". This rest is useful for cases in
495which your profile contains \*(L"half\*(R" holidays, or when you add
496or subtract fractions of a day.
497.Sp
498Sometimes it is not possible to accomodate the requested number
499of work days, and a rest remains.
500.Sp
501This rest can currently only assume the value \*(L"0.0\*(R" (zero),
502\&\*(L"\-0.5\*(R" (minus one half) or \*(L"0.5\*(R" (one half), provided you
503use only integral or multiples of 0.5 as offsets. A rest
504of zero indicates that the calculation yielded an exact
505result. If the rest is 0.5 or \-0.5, this is to be interpreted
506as \*(L"the resulting date at 12:00 o'clock\*(R", instead of as \*(L"the
507resulting date at 0:00 o'clock\*(R".
508.Sp
509The rest is always positive (or zero) if the offset \*(L"\s-1DELTA\s0\*(R"
510is positive (or zero), and always negative (or zero) if the
511offset is negative (or zero).
512.Sp
513Example:
514.Sp
515.Vb 9
516\& #!perl
517\& use Date::Calendar;
518\& use Date::Calendar::Profiles qw( $Profiles );
519\& $year = shift;
520\& $cal = Date::Calendar->new( $Profiles->{'sdm-MUC'} );
521\& ($date,$rest) = $cal->add_delta_workdays($year,1,3, -3);
522\& $date->date_format(1);
523\& print "\e$date = $date, \e$rest = $rest.\en";
524\& __END__
525.Ve
526.Sp
527This program calculates \*(L"January 3rd of the given year minus
5283 work days\*(R":
529.Sp
530.Vb 4
531\& > perl test.pl 2001
532\& $date = 28-Dec-2000, $rest = 0.
533\& > perl test.pl 2002
534\& $date = 28-Dec-2001, $rest = -0.5.
535.Ve
536.Sp
537Note that December 31st is a \*(L"half\*(R" holiday in 2001 for the
538calendar profile used in this example.
539.Sp
540You can easily verify the results above with the help of the
541\&\*(L"calendar.cgi\*(R" \s-1CGI\s0 script or the \*(L"linearcal.pl\*(R" script from
542the \*(L"examples\*(R" subdirectory in the Date::Calc distribution.
543.IP "\(bu" 2
544\&\f(CW\*(C`$flag = $calendar\->is_full(YEAR,MONTH,DAY|DATE);\*(C'\fR
545.Sp
546This method returns \*(L"true\*(R" (\*(L"1\*(R") if the bit corresponding to
547the given date is set in the bit vector representing \*(L"full\*(R"
548holidays, and \*(L"false\*(R" (\*(L"0\*(R") otherwise.
549.Sp
550I.e., the method returns \*(L"true\*(R" if the given date is a (full)
551holiday (according to the calendar profile associated with the
552given calendar object).
553.Sp
554The corresponding Date::Calendar::Year object is created first
555and stored in the calendar object's cache if necessary (if it's
556not already there).
557.Sp
558Note that you can get a reference to this bit vector (in order
559to use this bit vector in bit vector operations) as follows:
560.Sp
561.Vb 1
562\& $vec_full = $calendar->year($year)->vec_full();
563.Ve
564.Sp
565The number of bits in this bit vector is the same as the number
566of days in the given year "\f(CW$year\fR\*(L", which you can retrieve
567through either \*(R"\f(CW\*(C`$days = $vec_full\->Size();\*(C'\fR\*(L" or
568\&\*(R"\f(CW\*(C`$days = $year\->val_days();\*(C'\fR".
569.Sp
570See \fIDate::Calendar::Year\fR\|(3) and \fIBit::Vector\fR\|(3) for more
571details.
572.IP "\(bu" 2
573\&\f(CW\*(C`$flag = $calendar\->is_half(YEAR,MONTH,DAY|DATE);\*(C'\fR
574.Sp
575This method returns \*(L"true\*(R" (\*(L"1\*(R") if the bit corresponding to
576the given date is set in the bit vector representing \*(L"half\*(R"
577holidays, and \*(L"false\*(R" (\*(L"0\*(R") otherwise.
578.Sp
579I.e., the method returns \*(L"true\*(R" if the given date is a half
580holiday (according to the calendar profile associated with the
581given calendar object).
582.Sp
583Note that if a date is a \*(L"full\*(R" holiday, the \*(L"half\*(R" bit is
584never set, even if you try to do so in your calendar profile,
585on purpose or by accident.
586.Sp
587The corresponding Date::Calendar::Year object is created first
588and stored in the calendar object's cache if necessary (if it's
589not already there).
590.Sp
591Note that you can get a reference to this bit vector (in order
592to use this bit vector in bit vector operations) as follows:
593.Sp
594.Vb 1
595\& $vec_half = $calendar->year($year)->vec_half();
596.Ve
597.Sp
598The number of bits in this bit vector is the same as the number
599of days in the given year "\f(CW$year\fR\*(L", which you can retrieve
600through either \*(R"\f(CW\*(C`$days = $vec_half\->Size();\*(C'\fR\*(L" or
601\&\*(R"\f(CW\*(C`$days = $year\->val_days();\*(C'\fR".
602.Sp
603See \fIDate::Calendar::Year\fR\|(3) and \fIBit::Vector\fR\|(3) for more
604details.
605.IP "\(bu" 2
606\&\f(CW\*(C`$flag = $calendar\->is_work(YEAR,MONTH,DAY|DATE);\*(C'\fR
607.Sp
608This method returns \*(L"true\*(R" (\*(L"1\*(R") if the bit corresponding to
609the given date is set in the bit vector used to perform all
610sorts of calculations, and \*(L"false\*(R" (\*(L"0\*(R") otherwise.
611.Sp
612The corresponding Date::Calendar::Year object is created first
613and stored in the calendar object's cache if necessary (if it's
614not already there).
615.Sp
616\&\fB\s-1BEWARE\s0\fR that the \*(L"work\*(R" in this method's name does \fB\s-1NOT\s0\fR
617come from \*(L"work days\*(R"!
618.Sp
619It comes from the fact that the corresponding bit vector can
620be used for any \*(L"work\*(R" that you need to do. In other words,
621it's a \*(L"work space\*(R".
622.Sp
623Therefore, this bit vector might contain about everything you
624could imagine \- including a bit pattern which marks all \*(L"work
625days\*(R" with set bits, if it so happens!
626.Sp
627But you better don't rely on it, unless you put the bit pattern
628there yourself in the first place.
629.Sp
630Note that you can get a reference to this bit vector (in order
631to fill it with any bit pattern you like) as follows:
632.Sp
633.Vb 1
634\& $vec_work = $calendar->year($year)->vec_work();
635.Ve
636.Sp
637The number of bits in this bit vector is the same as the number
638of days in the given year "\f(CW$year\fR\*(L", which you can retrieve
639through either \*(R"\f(CW\*(C`$days = $vec_work\->Size();\*(C'\fR\*(L" or
640\&\*(R"\f(CW\*(C`$days = $year\->val_days();\*(C'\fR".
641.Sp
642See \fIDate::Calendar::Year\fR\|(3) and \fIBit::Vector\fR\|(3) for more
643details.
644.SH "SEE ALSO"
645.IX Header "SEE ALSO"
646\&\fIDate::Calendar::Year\fR\|(3), \fIDate::Calendar::Profiles\fR\|(3),
647\&\fIDate::Calc::Object\fR\|(3), \fIDate::Calc\fR\|(3), \fIBit::Vector\fR\|(3).
648.SH "VERSION"
649.IX Header "VERSION"
650This man page documents \*(L"Date::Calendar\*(R" version 5.3.
651.SH "AUTHOR"
652.IX Header "AUTHOR"
653.Vb 3
654\& Steffen Beyer
655\& mailto:sb@engelschall.com
656\& http://www.engelschall.com/u/sb/download/
657.Ve
658.SH "COPYRIGHT"
659.IX Header "COPYRIGHT"
660Copyright (c) 2000 \- 2002 by Steffen Beyer. All rights reserved.
661.SH "LICENSE"
662.IX Header "LICENSE"
663This package is free software; you can redistribute it and/or
664modify it under the same terms as Perl itself, i.e., under the
665terms of the \*(L"Artistic License\*(R" or the \*(L"\s-1GNU\s0 General Public License\*(R".
666.PP
667Please refer to the files \*(L"Artistic.txt\*(R" and \*(L"\s-1GNU_GPL\s0.txt\*(R"
668in this distribution for details!
669.SH "DISCLAIMER"
670.IX Header "DISCLAIMER"
671This package is distributed in the hope that it will be useful,
672but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of
673\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.
674.PP
675See the \*(L"\s-1GNU\s0 General Public License\*(R" for more details.