1POSIX::strftime::CompilUesre(r3pCmo)ntributed Perl DocumPeOnStIaXt:i:osntrftime::Compiler(3pm)
2
3
4

NAME

6       POSIX::strftime::Compiler - GNU C library compatible strftime for
7       loggers and servers
8

SYNOPSIS

10           use POSIX::strftime::Compiler qw/strftime/;
11
12           say strftime('%a, %d %b %Y %T %z',localtime):
13
14           my $fmt = '%a, %d %b %Y %T %z';
15           my $psc = POSIX::strftime::Compiler->new($fmt);
16           say $psc->to_string(localtime);
17

DESCRIPTION

19       POSIX::strftime::Compiler provides GNU C library compatible
20       strftime(3). But this module will not affected by the system locale.
21       This feature is useful when you want to write loggers, servers and
22       portable applications.
23
24       For generate same result strings on any locale,
25       POSIX::strftime::Compiler wraps POSIX::strftime and converts some
26       format characters to perl code
27

FUNCTION

29       strftime($fmt:String, @time)
30           Generate formatted string from a format and time.
31
32             my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
33             strftime('%d/%b/%Y:%T %z',$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst):
34
35           Compiled codes are stored in %POSIX::strftime::Compiler::STRFTIME.
36           This function is not exported by default.
37

METHODS

39       new($fmt)
40           create instance of POSIX::strftime::Compiler
41
42       to_string(@time)
43           Generate formatted string from time.
44

FORMAT CHARACTERS

46       POSIX::strftime::Compiler supports almost all characters that GNU
47       strftime(3) supports.  But %E[cCxXyY] and %O[deHImMSuUVwWy] are not
48       supported, just remove E and O prefix.
49

A RECOMMEND MODULE

51       Time::TZOffset
52           If Time::TZOffset is available, P::s::Compiler use it for more
53           faster time zone offset calculation.  I strongly recommend you to
54           install this if you use %z.
55

PERFORMANCE ISSUES ON WINDOWS

57       Windows and Cygwin and some system may not support %z and %Z. For these
58       system, POSIX::strftime::Compiler calculate time zone offset and find
59       zone name. This is not fast.  If you need performance on Windows and
60       Cygwin, please install Time::TZOffset
61

SEE ALSO

63       POSIX::strftime::GNU
64           POSIX::strftime::Compiler is built on POSIX::strftime::GNU::PP code
65
66       POSIX
67       Apache::LogFormat::Compiler
68

LICENSE

70       Copyright (C) Masahiro Nagano.
71
72       Format specification is based on strftime(3) manual page which is a
73       part of the Linux man-pages project.
74
75       This library is free software; you can redistribute it and/or modify it
76       under the same terms as Perl itself.
77

AUTHOR

79       Masahiro Nagano <kazeburo@gmail.com>
80
81
82
83perl v5.38.0                      2023-11-24    POSIX::strftime::Compiler(3pm)
Impressum