Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Users

what value exactly ticket.time and ticke.changetime return

 

 

Trac users RSS feed   Index | Next | Previous | View Threaded


helenfool at gmail

Mar 21, 2012, 5:04 AM

Post #1 of 2 (153 views)
Permalink
what value exactly ticket.time and ticke.changetime return

Hello everyone. I'm using Trac 0.12, and my question is: what value
exactly ticket.time and ticke.changetime return? I selected
changetime and it returned value as "1331537781158000".

I just wanted to get how long before the ticket was modified. And I'm
using the following scripts I got from trac.edgewall.org:

SELECT p.value AS __color__,
t.owner AS __group__,
t.type,
id AS ticket, summary, component, version, t.severity AS severity,
(CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS
owner,
(CASE WHEN round(time.now*1000000 - changetime) > 86400
THEN round((time.now*1000000 - changetime)/86400.0) || ' days'
WHEN time.now*1000000 - changetime > 3600
THEN round((time.now*1000000 - changetime)/3600.0) || ' hours'
ELSE round((time.now*1000000 - changetime)/60) || ' mins'
END) AS LastModified,
description AS _description,
reporter AS _reporter,
milestone AS _milestone
FROM ticket t ,
enum p,
(SELECT current_timestamp as now) time
WHERE p.name = t.priority AND p.type = 'priority'
ORDER BY t.owner, changetime desc, p.value, t.severity, time

However, the "LastModified" returned a wired minus value for me. Could
anyone pls help? I've been working on this for a whole day. Thanks a
lot.

Helen
2012.3.21

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


seccanj at gmail

Mar 22, 2012, 11:58 AM

Post #2 of 2 (147 views)
Permalink
Re: what value exactly ticket.time and ticke.changetime return [In reply to]

Hi,
those numbers are UNIX timestamps.

You can format them as a date and time using some DB built-in functions.

In case you use SQLite (the default for Trac), you can do as
follows: wherever you read "changetime" in your report, replace with:
datetime(changetime/1000000, 'unixepoch')

You can find a full set of functions and options in the SQLite
documentaiton:
http://www.sqlite.org/lang_datefunc.html

Ciao,
Roberto


2012/3/21 Helen <helenfool [at] gmail>

> Hello everyone. I'm using Trac 0.12, and my question is: what value
> exactly ticket.time and ticke.changetime return? I selected
> changetime and it returned value as "1331537781158000".
>
> I just wanted to get how long before the ticket was modified. And I'm
> using the following scripts I got from trac.edgewall.org:
>
> SELECT p.value AS __color__,
> t.owner AS __group__,
> t.type,
> id AS ticket, summary, component, version, t.severity AS severity,
> (CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS
> owner,
> (CASE WHEN round(time.now*1000000 - changetime) > 86400
> THEN round((time.now*1000000 - changetime)/86400.0) || ' days'
> WHEN time.now*1000000 - changetime > 3600
> THEN round((time.now*1000000 - changetime)/3600.0) || ' hours'
> ELSE round((time.now*1000000 - changetime)/60) || ' mins'
> END) AS LastModified,
> description AS _description,
> reporter AS _reporter,
> milestone AS _milestone
> FROM ticket t ,
> enum p,
> (SELECT current_timestamp as now) time
> WHERE p.name = t.priority AND p.type = 'priority'
> ORDER BY t.owner, changetime desc, p.value, t.severity, time
>
> However, the "LastModified" returned a wired minus value for me. Could
> anyone pls help? I've been working on this for a whole day. Thanks a
> lot.
>
> Helen
> 2012.3.21
>
> --
> You received this message because you are subscribed to the Google Groups
> "Trac Users" group.
> To post to this group, send email to trac-users [at] googlegroups
> To unsubscribe from this group, send email to
> trac-users+unsubscribe [at] googlegroups
> For more options, visit this group at
> http://groups.google.com/group/trac-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.

Trac users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.