Implementing stop-watch on photon

Hello There!
I am making a project where I am sending an ON signal from a custom Android app.Then the led switches ON until I send an OFF signal.Now I want to count the amount of seconds the led was on.Can anyone please help me with this?
Thanks in advance!

@Shapy, take a look at the Time functions in the documentation:



And for higher “precision” you could use millis() to get the duration in milliseconds, but take into account that you will have some variance due to the network latency which might change between the start and the stop command.