Re: commit/psi: 3 new changesets

0 views
Skip to first unread message

Erick Tryzelaar

unread,
Jul 2, 2009, 10:42:27 PM7/2/09
to psi-d...@googlegroups.com
On Thu, Jul 2, 2009 at 7:31 PM, <commits...@bitbucket.org> wrote:
>
> This branch partially implements Floris's Time API proposal, described here:
>
> http://bitbucket.org/chrismiles/psi/wiki/TimeAPI
>
> It extends the TimeSpec to add the functions:
>
> timestamp
> datetime
> utcdatetime
> timedelta
>
> ... and changes the following functions to return `TimeSpec`s:
>
> psi.boottime()
> psi.uptime()
> psi.process.Process.start_time
> psi.process.Process.utime
> psi.process.Process.stime
> psi.process.Process.cputime


Hello again all :) I had a free afternoon, so I implemented this :)
Fyi, this is my first branch with Hg, so I can't guarantee that I did
it correctly. I still need to add support for:

.float()
.mktime()
.timetuple()
.gmtime()
.localtime()

We should also add support for doing:

process.start_time == (123, 567)

In order to make it more tuple-like.

Floris Bruynooghe

unread,
Jul 3, 2009, 7:39:23 AM7/3/09
to psi-d...@googlegroups.com
On Thu, Jul 02, 2009 at 07:42:27PM -0700, Erick Tryzelaar wrote:
> Hello again all :) I had a free afternoon, so I implemented this :)

Thanks!

> Fyi, this is my first branch with Hg, so I can't guarantee that I did
> it correctly. I still need to add support for:

I added tests for those.

> We should also add support for doing:
>
> process.start_time == (123, 567)
>
> In order to make it more tuple-like.

That's a good idea. But what about addition, subtraction with tuples?
Should that work too?

Another point that I'm as yet undecided is if you should be able to
compare (and add/subtract) with integers/floats where the number would
be treated as a timestamp.

Related to this, should 'int(timespec_obj)' and 'float(timespec_obj)'
work too?

I'm tempted to say yes to most of these things, but it makes things
more implicit and maybe explicit is better as it's clear what's
happening.

Anyway, none of these questions are a blocker for starting to use the
TimeSpec class.

Regards
Floris


--
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org

Reply all
Reply to author
Forward
0 new messages