A
A
AlexRAV2016-03-20 11:18:08
JavaScript
AlexRAV, 2016-03-20 11:18:08

How to debug the loading of a script in a certain period of time?

Hello.
In general, I have a script that, when launched, performs one action and then, every hour, performs the same action.
I wrote the script, it works (I had to wait an hour of real time to check if it works)
The algorithm is basically simple, while running the script, we make the timestamp new Date().getTime() , then, at the event, we check (initial timestamp + hour ) <= (current label) and if the condition is met, then, of course, an action occurs.
The question is, are there any tools to debug such things? I tried to translate the time on my computer, it turned out the following: The label from the script showed that the time did not increase when the clock was changed, i.e. it went on as usual (9 seconds have passed since the launch, I change the time, the label in the script, relatively speaking, still shows 9 seconds). At the same time, after changing the time, I write new Date().getTime() to the console, it shows that the time has increased by an hour.
I will add that the script works in background.js in the Chrome extension.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question