make sure USE_THREADS is defined so external apps work
[p5sagit/p5-mst-13.2.git] / pod / perlfaq4.pod
index dfd6374..826d793 100644 (file)
@@ -249,23 +249,6 @@ L<perlfunc/"localtime">):
 
     $day_of_year = (localtime(time()))[7];
 
-or more legibly (in 5.7.1 or higher):
-
-    use Time::Piece;
-    $day_of_year = localtime->day_of_year();
-
-You can find the week of the year by using Time::Piece's strftime():
-
-    $week_of_year = localtime->strftime("%U");
-    $iso_week = localtime->strftime("%V");
-
-The difference between %U and %V is that %U assumes that the first day
-of week 1 is the first Sunday of the year, whereas ISO 8601:1988 uses
-the first week that has at least 4 days in the current year, and with
-Monday as the first day of the week. You can also use %W, which will
-return the week of the year with Monday as the first day of week 1. See
-your strftime(3) man page for more details.
-
 =head2 How do I find the current century or millennium?
 
 Use the following simple functions:
@@ -295,10 +278,6 @@ your dates, then you should probably use either of the Date::Manip and
 Date::Calc modules from CPAN before you go hacking up your own parsing
 routine to handle arbitrary date formats.
 
-Also note that the core module Time::Piece overloads the addition and
-subtraction operators to provide date calculation options. See
-L<Time::Piece/Date Calculations>.
-
 =head2 How can I take a string and turn it into epoch seconds?
 
 If it's a regular enough string that it always has the same format,
@@ -308,19 +287,15 @@ and Date::Manip modules from CPAN.
 
 =head2 How can I find the Julian Day?
 
-Use Time::Piece as follows:
-
-    use Time::Piece;
-    my $julian_day = localtime->julian_day;
-    my $mjd = localtime->mjd; # modified julian day
+Use the Time::JulianDay module (part of the Time-modules bundle
+available from CPAN.)
 
 Before you immerse yourself too deeply in this, be sure to verify that
 it is the I<Julian> Day you really want.  Are you interested in a way
 of getting serial days so that you just can tell how many days they
 are apart or so that you can do also other date arithmetic?  If you
 are interested in performing date arithmetic, this can be done using
-Time::Piece (standard module since Perl 5.8), or by modules
-Date::Manip or Date::Calc.
+modules Date::Manip or Date::Calc.
 
 There is too many details and much confusion on this issue to cover in
 this FAQ, but the term is applied (correctly) to a calendar now
@@ -343,14 +318,6 @@ epoch.  Take twenty-four hours off that:
 Then you can pass this to C<localtime()> and get the individual year,
 month, day, hour, minute, seconds values.
 
-Alternatively, you can use Time::Piece to subtract a day from the value
-returned from C<localtime()>:
-
-    use Time::Piece;
-    use Time::Seconds; # imports seconds constants, like ONE_DAY
-    my $today = localtime();
-    my $yesterday = $today - ONE_DAY;
-
 Note very carefully that the code above assumes that your days are
 twenty-four hours each.  For most people, there are two days a year
 when they aren't: the switch to and from summer time throws this off.
@@ -1324,6 +1291,12 @@ in the permute() function should work on any list:
        }
     }
 
+Unfortunately, this algorithm is very inefficient. The Algorithm::Permute
+module from CPAN runs at least an order of magnitude faster. If you don't
+have a C compiler (or a binary distribution of Algorithm::Permute), then
+you can use List::Permutor which is written in pure Perl, and is still
+several times faster than the algorithm above.
+
 =head2 How do I sort an array by (anything)?
 
 Supply a comparison function to sort() (described in L<perlfunc/sort>):