Using a time duration to print out data where every 2 seconds is a pixel

cjt22 at bath.ac.uk cjt22 at bath.ac.uk
Tue Sep 11 02:41:21 EDT 2007


 On Sep 10, 6:39 pm, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Mon, 10 Sep 2007 07:57:58 -0700, cj... at bath.ac.uk declaimed the
> following in comp.lang.python:
>
> > >from time import *
> > >startPoint = strptime(step.sTime, "%H:%S:%M")
> > >finishPoint = strptime(step.fTime, "%H:%S:%M")
>
> > >duration = mktime(startPoint) - mktime(finishPoint)
>
>         Ignoring the mktime() error, shouldn't those be reversed -- end
> times are larger than start times...
>
> > but it generates the error
>
> > >OverflowError: mktime argument out of range
>
>         I suspect you will need to supply a full date... mktime() wants
> calendar date/time values, not some HMS value that is relative to an
> arbitrary zero. That is, if your data is in the form "9h 5m, 20s from
> start of effort" you need to supply a dummy day representing "start of
> effort" (midnight probably)
>
>         Maybe look at the documentation for the datetime module -- in
> particular timedelta()
>
> >>> from datetime import timedelta
> >>> pStart = timedelta(hours=9, minutes=5, seconds=20)
> >>> pEnd = timedelta(hours=13, minutes=21, seconds=5)
> >>> dur = pEnd - pStart
> >>> print dur.days, dur.seconds, dur.microseconds
>
> 0 15345 0
> --
>         Wulfraed        Dennis Lee Bieber               KD6MOG
>         wlfr... at ix.netcom.com             wulfr... at bestiaria.com
>                 HTTP://wlfraed.home.netcom.com/
>         (Bestiaria Support Staff:               web-a... at bestiaria.com)
>                 HTTP://www.bestiaria.com/

Thanks for all the help, I will have a look at my errors today.

Can I also ask does anyone know how I could plot the "gannt chart"
looking representation of my data without having to install something
such as gnu plot. i.e. how would I simply work out how to move a space
accross the screen every 2 seconds, if a Step lasted 45 seconds for
example how would I represent that in terms of a print out with
spaces?

I hope that makes sense!




More information about the Python-list mailing list