W
W
wickedweasel2012-10-23 09:36:09
Time Management
wickedweasel, 2012-10-23 09:36:09

What do you use time for (new Date, Date.now(), process.hrtime(), etc.) in node.js?

Several options come to my mind why it might be necessary to know the time:

  1. to mark events (a log that something happened then).
  2. fix the dates of creation/registration/deletion of entities (blog entries).
  3. to limit some activity (or inactivity) in time. All sorts of timeouts go here (including indirectly through setTimeout, for example).
  4. to take some action from time to time.
  5. to measure how long something worked (benchmarks, etc.).
  6. real-time clock for the user.

Fantasy is not enough.

I am interested in order to understand what are the requirements for the accuracy of calculating time. For example, in benchmarks, the requirements are very high, and for timeouts, accuracy of + - 1 sec can often be enough.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Keenest, 2012-10-23
@Keenest

I, for example, among other things, use the process.uptime () function to view the uptime of the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question