1 # Blosxom Plugin: date_rfc822
2 # Author(s): Axel Beckert <abe@deuxchevaux.org>, based on 822-date
4 # Documentation: See the bottom of this file or type: perldoc date_rfc822
8 $date; # use as $date_rfc822::date
10 use POSIX qw(strftime);
17 my ($pkg, $path, $date_ref, $mtime, @date_bits) = @_;
19 @localtm = localtime ($mtime);
20 $localtms = localtime ($mtime);
21 @gmttm = gmtime ($mtime);
22 $gmttms = gmtime ($mtime);
24 if ($localtm[0] != $gmttm[0]) {
25 die (sprintf ("local timezone differs from GMT by a non-minute interval\n"
27 . "GMT time: %s\n", $localtms, $gmttms));
30 $localmin = $localtm[1] + $localtm[2] * 60;
31 $gmtmin = $gmttm[1] + $gmttm[2] * 60;
33 if ((($gmttm[6] + 1) % 7) == $localtm[6]) {
35 } elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) {
37 } elsif ($gmttm[6] == $localtm[6]) {
40 die ("822-date: local time offset greater than or equal to 24 hours\n");
43 $offset = $localmin - $gmtmin;
44 $offhour = $offset / 60;
45 $offmin = abs ($offset % 60);
47 if (abs ($offhour) >= 24) {
48 die ("822-date: local time offset greater than or equal to 24 hours\n");
53 "%s, %2d %s %d %02d:%02d:%02d %s%02d%02d",
54 (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$localtm[6]], # day of week
55 $localtm[3], # day of month
56 (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$localtm[4]], # month
57 $localtm[5]+1900, # year
61 ($offset >= 0) ? '+' : '-',# TZ offset direction
62 abs ($offhour), # TZ offset hour
63 $offmin, # TZ offset minute
64 ) || die "822-date: output error: $!\n";
76 Blosxom Plug-in: date_rfc822