angular-timer icon indicating copy to clipboard operation
angular-timer copied to clipboard

Initializing timer with some start value.

Open cyb-supriyaka opened this issue 9 years ago • 2 comments

Hi,

I came across this easy to use task-timer a few days back, it's really wonderful. I want to show elapsed time in hh:mm:ss format, which I could show. But now when I have to give some start-time to timer, it is not showing perfect time. I wanted to initialize the start time to 4 seconds so, I wrote the code below:

<timer interval='1000', start-time='4000'>  {{hhours}}:{{mminutes}}:{{sseconds}}</timer>

The code above doesn't seem to work as timer takes some wrong value as shown below:

12:09:28 Can some one tell me why it happens or there is certainly something wrong in my syntax? Plus can we change the start time of the task timer to some value dynamically?

Thanks, Supriya

cyb-supriyaka avatar May 02 '16 12:05 cyb-supriyaka

The issue is that it is passing the value of start-time to moment which is seeing it as the number of milliseconds in a Unix timestamp. This means that you are some time in 1970

observstream avatar Jun 18 '16 19:06 observstream

"Angular-timer" probably uses UNIX Timestamp.

A UNIX timestamp, also known as Epoch Time or POSIX timestamp, is a representation of a moment defined as the time that has elapsed since a reference known as the UNIX epoch: 1970-01-01 00:00:00 UTC

start-time translate the given parameter to milliseconds since 1970-01-01 00:00:00

samuelpetroline avatar Jan 13 '17 17:01 samuelpetroline