diff -ur twiki-unpatched/bin/changes twiki/bin/changes --- twiki-unpatched/bin/changes Sat Jun 28 16:10:46 2003 +++ twiki/bin/changes Sat Jun 28 17:41:10 2003 @@ -80,7 +80,7 @@ $wikiuser = &TWiki::userToWikiName( $bar[1] ); $foo =~ s/%AUTHOR%/$wikiuser/go; $foo =~ s/%LOCKED%//go; - $time = &TWiki::formatGmTime( $bar[2] ); + $time = &TWiki::formatLocTime( $bar[2] ); $frev = ""; if( $bar[3] ) { if( $bar[3] > 1 ) { diff -ur twiki-unpatched/bin/mailnotify twiki/bin/mailnotify --- twiki-unpatched/bin/mailnotify Sat Jun 28 16:10:46 2003 +++ twiki/bin/mailnotify Sat Jun 28 17:40:20 2003 @@ -121,7 +121,7 @@ if( ! $currLastmodify ) { # newest entry - $time = &TWiki::formatGmTime( $prevLastmodify ); + $time = &TWiki::formatLocTime( $prevLastmodify ); if( $prevLastmodify eq $changeTime ) { # newest entry is same as at time of previous notification $debug && print "- Note: No topics changed since $time\n"; @@ -152,7 +152,7 @@ $newText =~ s/%AUTHOR%/$wikiuser/go; $newText =~ s/%LOCKED%//go; - $time = &TWiki::formatGmTime( $changeTime ); + $time = &TWiki::formatLocTime( $changeTime ); $newText =~ s/%TIME%/$time/go; $newText =~ s/%REVISION%/$frev/go; $newText = &TWiki::getRenderedVersion( $newText ); @@ -194,7 +194,7 @@ $text =~ s/%EMAILTO%/$notifylist/go; $text =~ s/%EMAILBODY%/$emailbody/go; $text =~ s/%TOPICLIST%/$topiclist/go; - $text =~ s/%LASTDATE%/&TWiki::formatGmTime($prevLastmodify)/geo; + $text =~ s/%LASTDATE%/&TWiki::formatLocTime($prevLastmodify)/geo; $text = &TWiki::handleCommonTags( $text, $topic ); # change absolute addresses to relative ones & do some cleanup diff -ur twiki-unpatched/bin/view twiki/bin/view --- twiki-unpatched/bin/view Sat Jun 28 16:10:46 2003 +++ twiki/bin/view Sat Jun 28 17:51:27 2003 @@ -245,7 +245,7 @@ if( $topicExists ) { $revuser = &TWiki::userToWikiName( $revuser ); - my $temp = &TWiki::getRenderedVersion( "r1.$rev - $revdate GMT - $revuser" ); + my $temp = &TWiki::getRenderedVersion( "r1.$rev - $revdate - $revuser" ); $tmpl =~ s/%REVINFO%/$temp$mirrorNote/go; } else { $tmpl =~ s/%REVINFO%/$mirrorNote/go; diff -ur twiki-unpatched/lib/TWiki/Attach.pm twiki/lib/TWiki/Attach.pm --- twiki-unpatched/lib/TWiki/Attach.pm Sat Jun 28 16:10:46 2003 +++ twiki/lib/TWiki/Attach.pm Sat Jun 28 17:42:30 2003 @@ -292,7 +292,7 @@ my $attrComment = $attributes{"comment"}; my $attrAttr = $attributes{"attr"}; - $attrDate = &TWiki::formatGmTime( $attrDate ); + $attrDate = &TWiki::formatLocTime( $attrDate ); $attrUser = &TWiki::userToWikiName( $attrUser ); diff -ur twiki-unpatched/lib/TWiki/Store.pm twiki/lib/TWiki/Store.pm --- twiki-unpatched/lib/TWiki/Store.pm Sat Jun 28 16:10:46 2003 +++ twiki/lib/TWiki/Store.pm Sat Jun 28 17:47:03 2003 @@ -358,7 +358,7 @@ my( $rcsOut, $rev, $date, $user, $comment ) = $topicHandler->getRevisionInfo( $theRev ); if( $changeToIsoDate ) { - $date = TWiki::formatGmTime( $date ); + $date = TWiki::formatLocTime( $date ); } else { # FIXME get rid of this - shouldn't be needing rcs date time format $date = TWiki::Store::RcsFile::_epochToRcsDateTime( $date ); @@ -765,7 +765,7 @@ if( %topicinfo ) { # Stored as meta data in topic for faster access - $date = TWiki::formatGmTime( $topicinfo{"date"} ); # FIXME deal with changeToIsoDate + $date = TWiki::formatLocTime( $topicinfo{"date"} ); # FIXME deal with changeToIsoDate $author = $topicinfo{"author"}; my $tmp = $topicinfo{"version"}; $tmp =~ /1\.(.*)/o; diff -ur twiki-unpatched/lib/TWiki.pm twiki/lib/TWiki.pm --- twiki-unpatched/lib/TWiki.pm Sat Jun 28 16:10:47 2003 +++ twiki/lib/TWiki.pm Sat Jun 28 17:34:33 2003 @@ -993,6 +993,43 @@ } # ========================= +# Return local date/time as formatted string +# Suggested by Richard Lewis, October 2002 +sub formatLocTime +{ + my( $theTime, $theFormat ) = @_; + + my( $sec, $min, $hour, $mday, $mon, $year, $wday ) = localtime( $theTime ); + + if( $theFormat ) { + $year += 1900; + + if( $theFormat =~ /rcs/i ) { + # RCS format, example: "2001/12/31 23:59:59" + return sprintf( "%.4u/%.2u/%.2u %.2u:%.2u:%.2u", + $year, $mon+1, $mday, $hour, $min, $sec ); + } elsif ( $theFormat =~ /http|email/i ) { + # HTTP header format, e.g. "Thu, 23 Jul 1998 07:21:56 GMT" + # - based on RFC 2616/1123 and HTTP::Date; also used + # by TWiki::Net for Date header in emails. + return sprintf( "%s, %02d %s %04d %02d:%02d:%02d GMT", + $weekDay[$wday], $mday, $isoMonth[$mon], $year, + $hour, $min, $sec ); + } else { + # ISO Format, see spec at http://www.w3.org/TR/NOTE-datetime + # e.g. "2002-12-31T19:30Z" + return sprintf( "%.4u\-%.2u\-%.2uT%.2u\:%.2u:%.2uZ", + $year, $mon+1, $mday, $hour, $min, $sec ); + } + } + + # Default format, e.g. "31 Dec 2002 - 19:30" + my( $tmon ) = $isoMonth[$mon]; + $year = sprintf( "%.4u", $year + 1900 ); # Y2K fix + return sprintf( "%.2u ${tmon} %.2u - %.2u:%.2u", $mday, $year, $hour, $min ); +} + +# ========================= sub revDate2ISO { my $epochSec = revDate2EpSecs( $_[0] ); diff -ur twiki-unpatched/templates/changes.tmpl twiki/templates/changes.tmpl --- twiki-unpatched/templates/changes.tmpl Sat Jun 28 16:10:47 2003 +++ twiki/templates/changes.tmpl Sat Jun 28 17:53:55 2003 @@ -19,7 +19,7 @@ Topic: - Changed: now %GMTIME{"$hour:$min"}% GMT + Changed: now %SERVERTIME{"$hour:$min"}% Changed by: diff -ur twiki-unpatched/templates/mailnotify.tmpl twiki/templates/mailnotify.tmpl --- twiki-unpatched/templates/mailnotify.tmpl Sat Jun 28 16:10:47 2003 +++ twiki/templates/mailnotify.tmpl Sat Jun 28 17:52:57 2003 @@ -11,7 +11,7 @@ This is an automated email from %WIKITOOLNAME%. -New or changed topics in %WIKITOOLNAME%.%WEB%, since %LASTDATE% GMT: +New or changed topics in %WIKITOOLNAME%.%WEB%, since %LASTDATE%: %TOPICLIST% Review recent changes in: diff -ur twiki-unpatched/templates/search.tmpl twiki/templates/search.tmpl --- twiki-unpatched/templates/search.tmpl Sat Jun 28 16:10:47 2003 +++ twiki/templates/search.tmpl Sat Jun 28 17:54:21 2003 @@ -20,7 +20,7 @@ Topics in %WEB% web: - Changed: now %GMTIME{"$hour:$min"}% GMT + Changed: now %SERVERTIME{"$hour:$min"}% Changed by: diff -ur twiki-unpatched/templates/searchbookview.tmpl twiki/templates/searchbookview.tmpl --- twiki-unpatched/templates/searchbookview.tmpl Sat Jun 28 16:10:47 2003 +++ twiki/templates/searchbookview.tmpl Sat Jun 28 17:52:10 2003 @@ -20,7 +20,7 @@ Topics in %WEB% web: - Changed: GMT + Changed: Changed by: diff -ur twiki-unpatched/templates/searchrenameview.tmpl twiki/templates/searchrenameview.tmpl --- twiki-unpatched/templates/searchrenameview.tmpl Sat Jun 28 16:10:47 2003 +++ twiki/templates/searchrenameview.tmpl Sat Jun 28 17:54:50 2003 @@ -23,7 +23,7 @@ Topics in %WEB% web: - Changed: now %GMTIME{"$hour:$min"}% GMT + Changed: now %SERVERTIME{"$hour:$min"}% Changed by: