1How would you get the current timestamp in milliseconds since the epoch inside a Node.js service?
2If you need to run a function exactly five seconds from now, which built‑in timer would you use and how would you cancel it if needed?
3What does Date.now() return and how does it differ from creating a new Date object?
2-5 years experience
1We measure an API call’s duration with Date.now() but sometimes see negative values under load. What could cause that and how would you fix it?
2Design a simple rate‑limiter that allows 100 requests per minute. Which timer functions would you choose and why?
3Explain why setTimeout callbacks can fire later than the requested delay in a busy Node.js event loop.
5-8 years experience
1Design a high‑resolution performance logger for a microservice that needs sub‑millisecond precision. Which time APIs would you combine and what trade‑offs do they have?
2Our distributed system orders events by timestamps, but server clocks drift. How would you redesign time handling to avoid ordering bugs?
3During profiling you notice large gaps in process.hrtime readings during GC pauses. How would you account for that in your metrics?
8+ years experience
1We’re migrating a legacy codebase that uses Date everywhere to a deterministic time abstraction for testing and reproducible builds. What strategy would you propose for abstracting time across the organization?
2Discuss the implications of using setTimeout versus a durable message queue with delayed delivery for tasks that must survive process restarts.
3How would you establish a company‑wide policy for handling time zones, daylight‑saving changes, and monotonic clocks in both backend services and client‑side JavaScript?
Follow-up Questions
How would you mock or stub these functions in unit tests?
What are the risks of using a wall‑clock timer for measuring elapsed time?
Can you give an example where you’d prefer process.hrtime over Date.now?
Sharethis question
Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.