the code is full of errors
Why not fix them?
valves[ i ] is a struct. It is not going to equal ON or OFF. time_on is a member of a struct, not an array element.
If you are going to create a an array of structs, why not make before a member of that struct, too?