Skip to content

Commit

Permalink
Fix timestamps for sqlite backend
Browse files Browse the repository at this point in the history
It also uses microseconds.
  • Loading branch information
marmarek committed Mar 8, 2015
1 parent 1fd50b6 commit df34c32
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions trac2github.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
$trac_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// Boolean used to divide times by 1000000 when using Postgres where times are stored in microsecs (bigint)
$postgres=($pdo_driver == 'pgsql');
$time_in_us=($pdo_driver == 'pgsql' || $pdo_driver == 'sqlite');

echo "Connected to Trac\n";

Expand All @@ -143,7 +143,7 @@
continue;
}
//$milestones[$row['name']] = ++$mnum;
$epochInSecs = (int) ($row['due']/($postgres? 1000000:1));
$epochInSecs = (int) ($row['due']/($time_in_us? 1000000:1));
echo "due : ".date('Y-m-d\TH:i:s\Z', $epochInSecs)."\n";
$resp = github_add_milestone(array(
'title' => $row['name'],
Expand Down Expand Up @@ -257,7 +257,7 @@
}

$body = make_body($row['description']);
$timestamp = date("j M Y H:i e", $row['time']/($postgres? 1000000:1));
$timestamp = date("j M Y H:i e", $row['time']/($time_in_us? 1000000:1));
$body = '**Reported by ' . obfuscate_email($row['reporter']) . ' on ' . $timestamp . "**\n" . $body;

// There is a strange issue with summaries containing percent signs...
Expand Down

0 comments on commit df34c32

Please sign in to comment.