6 our(@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS, $VERSION);
9 @ISA = qw(Exporter Time::tm);
10 @EXPORT = qw(gmtime gmctime);
12 $tm_sec $tm_min $tm_hour $tm_mday
13 $tm_mon $tm_year $tm_wday $tm_yday
16 %EXPORT_TAGS = ( FIELDS => [ @EXPORT_OK, @EXPORT ] );
23 my $tmob = Time::tm->new();
25 $tm_sec, $tm_min, $tm_hour, $tm_mday,
26 $tm_mon, $tm_year, $tm_wday, $tm_yday,
32 sub gmtime (;$) { populate CORE::gmtime(@_ ? shift : time)}
33 sub gmctime (;$) { scalar CORE::gmtime(@_ ? shift : time)}
40 Time::gmtime - by-name interface to Perl's built-in gmtime() function
46 printf "The day in Greenwich is %s\n",
47 (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[ gm
->wday() ];
49 use Time
::gmtime w
(:FIELDS
;
50 printf "The day in Greenwich is %s\n",
51 (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[ gm_wday
() ];
57 $date_string = gmctime
(stat($file)->mtime);
61 This module's default exports override the core gmtime() function,
62 replacing it with a version that returns "Time::tm" objects.
63 This object has methods that return the similarly named structure field
64 name from the C's tm structure from F<time.h>; namely sec, min, hour,
65 mday, mon, year, wday, yday, and isdst.
67 You may also import all the structure fields directly into your namespace
68 as regular variables using the :FIELDS import tag. (Note that this
69 still overrides your core functions.) Access these fields as variables
70 named with a preceding C<tm_> in front their method names. Thus,
71 C<$tm_obj-E<gt>mday()> corresponds to $tm_mday if you import the fields.
73 The gmctime() function provides a way of getting at the
74 scalar sense of the original CORE::gmtime() function.
76 To access this functionality without the core overrides,
77 pass the C<use> an empty import list, and then access
78 function functions with their full qualified names.
79 On the other hand, the built-ins are still available
80 via the C<CORE::> pseudo-package.
84 While this class is currently implemented using the Class::Struct
85 module to build a struct-like class, you shouldn't rely upon this.