FAQ Maintainers Mailing List
Re: What format?

---------

From: Ralf Döblitz (doeblitz@gmx.de)
Date: Tue Aug 08 2000 - 12:57:40 CDT


On Tue, Aug 08, 2000 at 08:30:35AM -0700, Tom Holub wrote:
[...]
> perl's own POD viewer doesn't even work half the time.

... when used inappropriately. It is originally meant to display
complete POD files, not arbitrary chunks of a POD file.

> clue [50] perldoc -f localtime

And this cuts only the definiton of 'localtime' out of perlfunc and
perldoc tries to display it (and does it IMHO quite well considering
that the surrounding definitions etc. are missing).

Try to display the complete POD with
  perldoc perlfunc
and you will find that perldoc formats it very nicely:
| localtime EXPR
| Converts a time as returned by the time function
| to a 9-element array with the time analyzed for
| the local time zone. Typically used as follows:
|
| # 0 1 2 3 4 5 6 7 8
| ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
| localtime(time);
|
| All array elements are numeric, and come straight
| out of a struct tm. In particular this means that
| $mon has the range 0..11 and $wday has the range
| 0..6 with sunday as day 0. Also, $year is the
| number of years since 1900, that is, $year is 123
| in year 2023, and not simply the last two digits
| of the year. If you assume it is, then you create
| non-Y2K-compliant programs--and you wouldn't want
| to do that, would you?
|
| If EXPR is omitted, uses the current time
| (localtime(time)).
|
| In scalar context, returns the ctime(3) value:
|
| $now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994"
|
| This scalar value is not locale dependent, see the
| perllocale manpage, but instead a Perl builtin.
| Also see the Time::Local module, and the
| strftime(3) and mktime(3) function available via
| the POSIX module. To get somewhat similar but
| locale dependent date strings, set up your locale
| environment variables appropriately (please see
| the perllocale manpage) and try for example:
|
| use POSIX qw(strftime);
| $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
|
| Note that the %a and %b, the short forms of the
| day of the week and the month of the year, may not
| necessarily be three characters wide.

Ralf

-- 
Ralf Döblitz   *   Schapenstr. 6   *   38104 Braunschweig   *   Germany
Phone: +49-531-2361223                             Fax: +49-531-2361224
mailto:doeblitz@gmx.de               http://www.escape.de/users/selene/
mailto:rd@csi.com          OL: http://www.escape.de/users/selene/NTBOL/



[ FAQ Archive | Search FAQ Mail Archive | Authors | Usenet References ]
[ 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | 1999 | 2000
]

---------

faq-admin@faqs.org

© Copyright The Internet FAQ Consortium, 1997-2000
All rights reserved