1Time::gmtime(3pm) Perl Programmers Reference Guide Time::gmtime(3pm)
2
3
4
6 Time::gmtime - by-name interface to Perl's built-in gmtime() function
7
9 use Time::gmtime;
10 $gm = gmtime();
11 printf "The day in Greenwich is %s\n",
12 (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[ gm->wday() ];
13
14 use Time::gmtime w(:FIELDS;
15 printf "The day in Greenwich is %s\n",
16 (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[ gm_wday() ];
17
18 $now = gmctime();
19
20 use Time::gmtime;
21 use File::stat;
22 $date_string = gmctime(stat($file)->mtime);
23
25 This module's default exports override the core gmtime() function,
26 replacing it with a version that returns "Time::tm" objects. This
27 object has methods that return the similarly named structure field name
28 from the C's tm structure from time.h; namely sec, min, hour, mday,
29 mon, year, wday, yday, and isdst.
30
31 You may also import all the structure fields directly into your names‐
32 pace as regular variables using the :FIELDS import tag. (Note that
33 this still overrides your core functions.) Access these fields as
34 variables named with a preceding "tm_" in front their method names.
35 Thus, "$tm_obj->mday()" corresponds to $tm_mday if you import the
36 fields.
37
38 The gmctime() function provides a way of getting at the scalar sense of
39 the original CORE::gmtime() function.
40
41 To access this functionality without the core overrides, pass the "use"
42 an empty import list, and then access function functions with their
43 full qualified names. On the other hand, the built-ins are still
44 available via the "CORE::" pseudo-package.
45
47 While this class is currently implemented using the Class::Struct mod‐
48 ule to build a struct-like class, you shouldn't rely upon this.
49
51 Tom Christiansen
52
53
54
55perl v5.8.8 2001-09-21 Time::gmtime(3pm)