From 305b3f46881e02b324ffd11a4a2d9c883b14bae9 Mon Sep 17 00:00:00 2001 From: Thom Seddon Date: Tue, 11 Jun 2013 20:19:59 +0100 Subject: [PATCH] Unify modified/created times The former implementation meant that it was not guarantee that the times automatically generated for the modified/created fields would be exactly the same for a given operation. --- lib/Cake/Model/Model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index cbd08ca03..a0033c818 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1662,13 +1662,14 @@ class Model extends Object implements CakeEventListener { } $db = $this->getDataSource(); + $now = time(); foreach ($dateFields as $updateCol) { if ($this->hasField($updateCol) && !in_array($updateCol, $fields)) { $default = array('formatter' => 'date'); $colType = array_merge($default, $db->columns[$this->getColumnType($updateCol)]); if (!array_key_exists('format', $colType)) { - $time = strtotime('now'); + $time = $now; } else { $time = call_user_func($colType['formatter'], $colType['format']); }