Permalink
Browse files

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.
  • Loading branch information...
1 parent bbcc7b2 commit 305b3f46881e02b324ffd11a4a2d9c883b14bae9 @thomseddon thomseddon committed Jun 11, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/Cake/Model/Model.php
View
3 lib/Cake/Model/Model.php
@@ -1662,13 +1662,14 @@ public function save($data = null, $validate = true, $fieldList = array()) {
}
$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']);
}

0 comments on commit 305b3f4

Please sign in to comment.