I'm new to dzVents so need some help

I want to create an function which counts the minutes a certain switch is on and want to put the minutes in a variable (so I can use it in a blockly)
Can you experts give me an example of such code so I can play with it?
Thanks in advance....
Bob