[Tutor] time calc

Brian van den Broek bvande at po-box.mcgill.ca
Sat Jun 19 02:40:25 EDT 2004


kevin parks said unto the world upon 18/06/2004 13:36:

> hi all.
> 
> I have a bit of a task that i have been doing by hand, but as it turns 
> out there is pages and pages more of this so i would like to make a 
> python script that does this work and have it handy.
> 
> I have a list that has several columns like so:
> 
> 1    1    1    00:23
> 1    2    2    8:23
> 1    3    3    9:41
> 1    4    3    10:47
> 1    5    3     11:21
> 
> 
> What this is a list that has tape number, program number, item number 
> and start time for a recording.
> 
> What i want to do is append the duration to the end of this list by 
> subtracting the start of the item from the start time of the next so 
> that the first line would look like:
> 
> 1    1    1    00:23    08:00
> 1    2    2    8:23      01:18
> 
> etc.
> 
> So the task is really two part : reading in a list of numbers and adding 
> one more piece of data and (2) doing time (base 60) math. It is the time 
> math part i simply can't get my head around. Anyone know if there is a 
> module that does time math? or a method for doing this by hand?
> 
> cheers,
> 
> kevin parks
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 


Hi Kevin,

I have a question for you. If you know how to do the math on paper, why
not just use the same math in your program? (If you are doing it right
with pencil you *are* doing it is base 60 ;-)

Is the problem to see how to express the math in python code?

Best,

Brian vdB









More information about the Tutor mailing list