--- /dev/null
+# Blosxom Plugin: date_rfc822
+# Author(s): Axel Beckert <abe@deuxchevaux.org>, based on 822-date
+# Version: 1.0
+# Documentation: See the bottom of this file or type: perldoc date_rfc822
+
+package date_rfc822;
+
+$date; # use as $date_rfc822::date
+
+use POSIX qw(strftime);
+
+sub start {
+ 1;
+}
+
+sub date {
+ my ($pkg, $path, $date_ref, $mtime, @date_bits) = @_;
+
+@localtm = localtime ($mtime);
+$localtms = localtime ($mtime);
+@gmttm = gmtime ($mtime);
+$gmttms = gmtime ($mtime);
+
+if ($localtm[0] != $gmttm[0]) {
+ die (sprintf ("local timezone differs from GMT by a non-minute interval\n"
+ . "local time: %s\n"
+ . "GMT time: %s\n", $localtms, $gmttms));
+}
+
+$localmin = $localtm[1] + $localtm[2] * 60;
+$gmtmin = $gmttm[1] + $gmttm[2] * 60;
+
+if ((($gmttm[6] + 1) % 7) == $localtm[6]) {
+ $localmin += 1440;
+} elsif ((($gmttm[6] - 1) % 7) == $localtm[6]) {
+ $localmin -= 1440;
+} elsif ($gmttm[6] == $localtm[6]) {
+ 1;
+} else {
+ die ("822-date: local time offset greater than or equal to 24 hours\n");
+}
+
+$offset = $localmin - $gmtmin;
+$offhour = $offset / 60;
+$offmin = abs ($offset % 60);
+
+if (abs ($offhour) >= 24) {
+ die ("822-date: local time offset greater than or equal to 24 hours\n");
+}
+
+$date = sprintf
+ (
+ "%s, %2d %s %d %02d:%02d:%02d %s%02d%02d",
+ (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$localtm[6]], # day of week
+ $localtm[3], # day of month
+ (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$localtm[4]], # month
+ $localtm[5]+1900, # year
+ $localtm[2], # hour
+ $localtm[1], # minute
+ $localtm[0], # sec
+ ($offset >= 0) ? '+' : '-',# TZ offset direction
+ abs ($offhour), # TZ offset hour
+ $offmin, # TZ offset minute
+ ) || die "822-date: output error: $!\n";
+
+
+ 1;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Blosxom Plug-in: date_rfc822