trac2github icon indicating copy to clipboard operation
trac2github copied to clipboard

Timestamps in microsecs, wrong dates in github

Open bflorat opened this issue 11 years ago • 3 comments

Hi, Context : Trac 1.0.1, trac2github 76e8befb3cf261e539b6f9563f0ddb390e4d1f0a I use a PostgreSQL Trac database and I had to divide all times by 1000000 to get right dates for milestones, tickets and comments (date() php function takes epoch in secs only). Once done, milestones, tickets and comments dates are all right in GitHub.

Example: $resp = github_add_milestone(array( 'title' => $row['name'], 'state' => $row['completed'] == 0 ? 'open' : 'closed', 'description' => empty($row['description']) ? 'None' : $row['description'], 'due_on' => date('Y-m-d\TH:i:s\Z', (int) ($row['completed']/1000000))

What do you think ?

bflorat avatar Dec 02 '14 22:12 bflorat

What datatype does Trac use to store those dates in Postgres?

trustmaster avatar Dec 04 '14 10:12 trustmaster

tracdb=# \d+ ticket
                                        Table "public.ticket"
   Column    |  Type   |                      Modifiers                      | Storage  | Description 
-------------+---------+-----------------------------------------------------+----------+-------------
 id          | integer | not null default nextval('ticket_id_seq'::regclass) | plain    | 
 type        | text    |                                                     | extended | 
 time        | bigint  |                                                     | plain    | 
 changetime  | bigint  |                                                     | plain    | 
 component   | text    |                                                     | extended | 
 severity    | text    |                                                     | extended | 
 priority    | text    |                                                     | extended | 
 owner       | text    |                                                     | extended | 
 reporter    | text    |                                                     | extended | 
 cc          | text    |                                                     | extended | 
 version     | text    |                                                     | extended | 
 milestone   | text    |                                                     | extended | 
 status      | text    |                                                     | extended | 
 resolution  | text    |                                                     | extended | 
 summary     | text    |                                                     | extended | 
 description | text    |                                                     | extended | 
 keywords    | text    |                                                     | extended | 

bflorat avatar Dec 04 '14 20:12 bflorat

Oh, it's bigint. Then it makes sense converting into seconds if database is Postgres. Would you create another PR for this please?

trustmaster avatar Dec 04 '14 20:12 trustmaster