Date.now() in provision script

Zaid Abdulla zaid at genieacs.com
Fri Apr 28 15:36:25 EDT 2017


On Fri, 2017-04-28 at 21:16 +0200, mracek at poda.cz wrote:
> I ran into an interesting problem.
> I try to measure the time needed for certain steps in the 
> provisionig script, but Date.now() and similar functions returns 
> same value at the beginning and at the end. Even though I use a 
> very long while loop. Still same time.
> 
> Is time going differently in node.vm or what?

No :) Within provision and virtual parameter scripts Date.now() always
returns the time of the start of the session. This is intentional in
order to make scripts behave as a "pure function".

-- 
Zaid Abdulla <zaid at genieacs.com>


More information about the Users mailing list