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

cjt22 at cjt22 at
Mon Sep 10 14:32:25 CEST 2007

Hi there, I wonder if any of you could tell me the best way to going
about solving this little problem!

I have a list of Step objects containing their start and finish times
The steps are sorted so that they are in order of their step times
The start and finish times are in string format of "%H:%S:%M" all on
the same day

I want to be able print out the Steps as a visual representation so
that I can show
1. The order the steps started
2. The duration of the steps

i.e. a print out such as:

[    a    ]
           [ b ]
      [             c           ]

[ stepName ] is the duration of the Step (i.e. 1 pixel for every 2
seconds it lasted)
[  a ] started first so it is printed first,   [ b ] started x seconds
later so it is printed y pixels tabbed away form the side etc etc

Any help would be much appreciated.

Another related question is that I can't seem to do arithmetic when
the variables are in String format
of  %H:%M:%S or converted to type struct_time

> startPoint = strptime(step.sTime, "%H:%S:%M")
> finishPoint = strptime(step.fTime, "%H:%S:%M")
> duration = finishPoint - startPoint

generates a error:
Type error: unsupport operand types for: 'time.struct_time' and

trying to do time arithmetic when the times are stored in this format
as strings also fails so any help regarding any of this would be muhc

More information about the Python-list mailing list