Use of gettimer

i wish to know how to use the gettimer to run my on(press) function…
let say i have an array consist of 10 elements, and each element will be called for an interval of 2second… how can i actually code it out?
i’ve tried something with this…

for (i=0;i<array.length;i++){
{A=gettimer()
if (gettimer()>2000)
{//run action
}
}

but it doesnt work…