[dw-free] Entries show as being posted at the current time when they are backdated to the beginning
[commit: http://hg.dwscoalition.org/dw-free/rev/b068031869cf]
http://bugs.dwscoalition.org/show_bug.cgi?id=2985
Beginning of time (January 1, 1970) == 0, so we need to check whether the
time is defined, not whether it is 0.
Patch by
exor674.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2985
Beginning of time (January 1, 1970) == 0, so we need to check whether the
time is defined, not whether it is 0.
Patch by
Files modified:
- cgi-bin/ljtimeutil.pl
--------------------------------------------------------------------------------
diff -r 4dc0abe1fabe -r b068031869cf cgi-bin/ljtimeutil.pl
--- a/cgi-bin/ljtimeutil.pl Tue Aug 31 12:54:57 2010 +0800
+++ b/cgi-bin/ljtimeutil.pl Tue Aug 31 13:12:21 2010 +0800
@@ -145,7 +145,7 @@ sub mysql_time
sub mysql_time
{
my ($time, $gmt) = @_;
- $time ||= time();
+ $time = time() unless defined $time;
my @ltime = $gmt ? gmtime($time) : localtime($time);
return sprintf("%04d-%02d-%02d %02d:%02d:%02d",
$ltime[5]+1900,
@@ -160,7 +160,7 @@ sub mysql_time
# returns: date in ISO format
sub mysql_date {
my ( $time, $gmt ) = @_;
- $time ||= time();
+ $time = time() unless defined $time;
my @ltime = $gmt ? gmtime( $time ) : localtime( $time );
return sprintf( "%04d-%02d-%02d",
$ltime[5]+1900, $ltime[4]+1, $ltime[3] );
--------------------------------------------------------------------------------

no subject
$time //= time();, but I think that only works in fairly new perls, which Dreamwidth probably doesn't want to require for their code.no subject
BTW, that's pretty interesting! Thanks for pointing it out *g*