diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result
index 5b34f36bd05ccd15ee05e4a40d765631bed9734c..a68ef517708f873908cb46bf42af2a0842e64109 100644
--- a/mysql-test/r/rpl000002.result
+++ b/mysql-test/r/rpl000002.result
@@ -2,3 +2,7 @@ n
 2000
 2001
 2002
+id	created
+1	1970-01-01 06:25:45
+id	created
+1	1970-01-01 06:25:45
diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test
index c982bd54b8c359f8507bbd4ad41f3e7fc8e6baff..0c490e6316de13cef1d036e258232644898eacd3 100644
--- a/mysql-test/t/rpl000002.test
+++ b/mysql-test/t/rpl000002.test
@@ -9,9 +9,26 @@ save_master_pos;
 connection slave;
 use test;
 sync_with_master;
-@r/rpl000002.result select * from t1;
+select * from t1;
 connection master;
 drop table t1;
 save_master_pos;
 connection slave;
 sync_with_master;
+slave stop;
+connection master;
+drop table if exists t2;
+create table t2(id int auto_increment primary key, created datetime);
+set timestamp=12345;
+insert into t2 set created=now();
+select * from t2;
+save_master_pos;
+connection slave;
+slave start;
+sync_with_master;
+select * from t2;
+connection master;
+drop table t2;
+save_master_pos;
+connection slave;
+sync_with_master;
diff --git a/sql/slave.cc b/sql/slave.cc
index c05b3478de00409a926fb6c01192e606361466f8..8b765eca2775c0a9f1e880716e67da8b20d5a5e7 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -857,7 +857,8 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
   
     thd->server_id = ev->server_id; // use the original server id for logging
     thd->set_time();				// time the query
-    ev->when = time(NULL);
+    if(!ev->when)
+      ev->when = time(NULL);
     
     switch(type_code) {
     case QUERY_EVENT: