diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-10 23:37:43 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-10 23:37:43 +0000 |
commit | 2a2bf5f4414cf2a1984ea82a90bfbb2c3384d4e1 (patch) | |
tree | e9b696536715a7a8e72661281d73d87ce4d1854a /pod | |
parent | a1866d1bf88d9abb7869ffddc5cb4448a6cb503a (diff) | |
download | perl-2a2bf5f4414cf2a1984ea82a90bfbb2c3384d4e1.tar.gz |
Decommission Time::Piece; unnecessary Yet Another Time-Date Module.
p4raw-id: //depot/perl@11631
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlfaq4.pod | 39 | ||||
-rw-r--r-- | pod/perllocale.pod | 2 | ||||
-rw-r--r-- | pod/perltoc.pod | 140 |
3 files changed, 32 insertions, 149 deletions
diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index dfd6374378..08f23f0b7c 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -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. diff --git a/pod/perllocale.pod b/pod/perllocale.pod index bedac38b14..7864addc3e 100644 --- a/pod/perllocale.pod +++ b/pod/perllocale.pod @@ -636,7 +636,7 @@ exists only to generate locale-dependent results, strftime() always obeys the current C<LC_TIME> locale. See also L<I18N::Langinfo> and C<ABDAY_1>..C<ABDAY_7>, C<DAY_1>..C<DAY_7>, -C<ABMON_1>..C<ABMON_12>, and C<ABMON_1>..C<ABMON_12>; and L<Time::Piece>. +C<ABMON_1>..C<ABMON_12>, and C<ABMON_1>..C<ABMON_12>. =head2 Other categories diff --git a/pod/perltoc.pod b/pod/perltoc.pod index 3f86e677e5..a250c6191d 100644 --- a/pod/perltoc.pod +++ b/pod/perltoc.pod @@ -884,32 +884,32 @@ listing $ARG, $_, $a, $b, $<I<digits>>, $MATCH, $&, $PREMATCH, $`, $POSTMATCH, $', $LAST_PAREN_MATCH, $+, $^N, @LAST_MATCH_END, @+, $MULTILINE_MATCHING, $*, input_line_number HANDLE EXPR, $INPUT_LINE_NUMBER, $NR, $, -input_record_separator HANDLE EXPR, $INPUT_RECORD_SEPARATOR, $RS, $/, -autoflush HANDLE EXPR, $OUTPUT_AUTOFLUSH, $|, output_field_separator HANDLE -EXPR, $OUTPUT_FIELD_SEPARATOR, $OFS, $,, output_record_separator HANDLE -EXPR, $OUTPUT_RECORD_SEPARATOR, $ORS, $\, $LIST_SEPARATOR, $", -$SUBSCRIPT_SEPARATOR, $SUBSEP, $;, $OFMT, $#, format_page_number HANDLE -EXPR, $FORMAT_PAGE_NUMBER, $%, format_lines_per_page HANDLE EXPR, -$FORMAT_LINES_PER_PAGE, $=, format_lines_left HANDLE EXPR, -$FORMAT_LINES_LEFT, $-, @LAST_MATCH_START, @-, C<$`> is the same as -C<substr($var, 0, $-[0])>, C<$&> is the same as C<substr($var, $-[0], $+[0] -- $-[0])>, C<$'> is the same as C<substr($var, $+[0])>, C<$1> is the same -as C<substr($var, $-[1], $+[1] - $-[1])>, C<$2> is the same as -C<substr($var, $-[2], $+[2] - $-[2])>, C<$3> is the same as C<substr $var, -$-[3], $+[3] - $-[3])>, format_name HANDLE EXPR, $FORMAT_NAME, $~, -format_top_name HANDLE EXPR, $FORMAT_TOP_NAME, $^, -format_line_break_characters HANDLE EXPR, $FORMAT_LINE_BREAK_CHARACTERS, -$:, format_formfeed HANDLE EXPR, $FORMAT_FORMFEED, $^L, $ACCUMULATOR, $^A, -$CHILD_ERROR, $?, $OS_ERROR, $ERRNO, $!, $EXTENDED_OS_ERROR, $^E, -$EVAL_ERROR, $@, $PROCESS_ID, $PID, $$, $REAL_USER_ID, $UID, $<, -$EFFECTIVE_USER_ID, $EUID, $>, $REAL_GROUP_ID, $GID, $(, -$EFFECTIVE_GROUP_ID, $EGID, $), $PROGRAM_NAME, $0, $[, $], $COMPILING, $^C, -$DEBUGGING, $^D, $SYSTEM_FD_MAX, $^F, $^H, %^H, $INPLACE_EDIT, $^I, $^M, -$OSNAME, $^O, $PERLDB, $^P, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, -0x100, 0x200, $LAST_REGEXP_CODE_RESULT, $^R, $EXCEPTIONS_BEING_CAUGHT, $^S, -$BASETIME, $^T, $PERL_VERSION, $^V, $WARNING, $^W, ${^WARNING_BITS}, -${^WIDE_SYSTEM_CALLS}, $EXECUTABLE_NAME, $^X, $ARGV, @ARGV, @F, @INC, @_, -%INC, %ENV, $ENV{expr}, %SIG, $SIG{expr} +IO::Handle->input_record_separator EXPR, $INPUT_RECORD_SEPARATOR, $RS, $/, +autoflush HANDLE EXPR, $OUTPUT_AUTOFLUSH, $|, +IO::Handle->output_field_separator EXPR, $OUTPUT_FIELD_SEPARATOR, $OFS, $,, +IO::Handle->output_record_separator EXPR, $OUTPUT_RECORD_SEPARATOR, $ORS, +$\, $LIST_SEPARATOR, $", $SUBSCRIPT_SEPARATOR, $SUBSEP, $;, $OFMT, $#, +format_page_number HANDLE EXPR, $FORMAT_PAGE_NUMBER, $%, +format_lines_per_page HANDLE EXPR, $FORMAT_LINES_PER_PAGE, $=, +format_lines_left HANDLE EXPR, $FORMAT_LINES_LEFT, $-, @LAST_MATCH_START, +@-, C<$`> is the same as C<substr($var, 0, $-[0])>, C<$&> is the same as +C<substr($var, $-[0], $+[0] - $-[0])>, C<$'> is the same as C<substr($var, +$+[0])>, C<$1> is the same as C<substr($var, $-[1], $+[1] - $-[1])>, C<$2> +is the same as C<substr($var, $-[2], $+[2] - $-[2])>, C<$3> is the same as +C<substr $var, $-[3], $+[3] - $-[3])>, format_name HANDLE EXPR, +$FORMAT_NAME, $~, format_top_name HANDLE EXPR, $FORMAT_TOP_NAME, $^, +IO::Handle->format_line_break_characters EXPR, +$FORMAT_LINE_BREAK_CHARACTERS, $:, IO::Handle->format_formfeed EXPR, +$FORMAT_FORMFEED, $^L, $ACCUMULATOR, $^A, $CHILD_ERROR, $?, $OS_ERROR, +$ERRNO, $!, $EXTENDED_OS_ERROR, $^E, $EVAL_ERROR, $@, $PROCESS_ID, $PID, +$$, $REAL_USER_ID, $UID, $<, $EFFECTIVE_USER_ID, $EUID, $>, $REAL_GROUP_ID, +$GID, $(, $EFFECTIVE_GROUP_ID, $EGID, $), $PROGRAM_NAME, $0, $[, $], +$COMPILING, $^C, $DEBUGGING, $^D, $SYSTEM_FD_MAX, $^F, $^H, %^H, +$INPLACE_EDIT, $^I, $^M, $OSNAME, $^O, $PERLDB, $^P, 0x01, 0x02, 0x04, +0x08, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, $LAST_REGEXP_CODE_RESULT, $^R, +$EXCEPTIONS_BEING_CAUGHT, $^S, $BASETIME, $^T, $PERL_VERSION, $^V, +$WARNING, $^W, ${^WARNING_BITS}, ${^WIDE_SYSTEM_CALLS}, $EXECUTABLE_NAME, +$^X, $ARGV, @ARGV, @F, @INC, @_, %INC, %ENV, $ENV{expr}, %SIG, $SIG{expr} =item Error Indicators @@ -15659,90 +15659,6 @@ getitimer ( $which ) =back -=head2 Time::Piece - Object Oriented time objects - -=over 4 - -=item SYNOPSIS - -=item DESCRIPTION - -=item USAGE - -=over 4 - -=item Local Locales - -=item Date Calculations - -=item Date Comparisons - -=item YYYY-MM-DDThh:mm:ss - -=item Week Number - -=item strftime method - -%%, %a, %A, %b, %B, %c, %C, %d, %D, %e, %h, %H, %I, %j, %m, %M, %n, %p, %r, -%R, %S, %t, %T, %u, %U, %V, %w, %W, %x, %y, %Y, %Z - -=item strptime function - -=item Global Overriding - -=back - -=item SEE ALSO - -=item AUTHOR - -=over 4 - -=item License - -=item Bugs - -=back - -=back - -=head2 Time::Piece::Seconds, Time::Seconds - a simple API to convert -seconds to other date values - -=over 4 - -=item SYNOPSIS - -=item DESCRIPTION - -=item METHODS - -=item AUTHOR - -=item LICENSE - -=item Bugs - -=back - -=head2 Time::Seconds - a simple API to convert seconds to other date values - -=over 4 - -=item SYNOPSIS - -=item DESCRIPTION - -=item METHODS - -=item AUTHOR - -=item LICENSE - -=item Bugs - -=back - =head2 Time::gmtime - by-name interface to Perl's built-in gmtime() function @@ -15798,7 +15714,7 @@ VAL, TYPE ), UNIVERSAL::can ( VAL, METHOD ) =back -=head2 UnicodeCD - Unicode character database +=head2 Unicode::UCD - Unicode character database =over 4 @@ -15870,7 +15786,7 @@ VAL, TYPE ), UNIVERSAL::can ( VAL, METHOD ) =over 4 -=item UnicodeCD::UnicodeVersion +=item Unicode::UCD::UnicodeVersion =back |