# timecard calculator problem...

This is a discussion on timecard calculator problem... within the C Programming forums, part of the General Programming Boards category; Okay... pretty simple, but i just wanted verification, does this look right? I'll be implementing this into a command-line based ...

1. ## timecard calculator problem...

Okay... pretty simple, but i just wanted verification, does this look right?

I'll be implementing this into a command-line based app, otherwise I'd use some spreadsheet or something.

Code:
```Data

x	in	09:25
out	13:14

y	in	13:45
out	18:13

Formula

hours(x,y) = ((in[hour] * 60 + in[minute]) - (out[hour] * 60 + out[minute])) / 60

Example

x(3.42) = ((9 * 60 + 25) - (13 * 60 + 14)) / 60
y(4.47) = ((13 * 60 + 45) - (18 * 60 + 13)) / 60
z(7.89) = x + y```

2. It seems to me the duration should be
Code:
`{hours} = {out} - {in}`
rather than
Code:
`{hours} = {in} - {out}`
Do you need to compensate for crossing a day boundary (that is, when you finish "before" you start)?