Welcome! Log In Create A New Profile

Advanced

Re: Getting current date and time with milliseconds precision

Maxim Dounin
November 16, 2022 01:10PM
Hello!

On Wed, Nov 16, 2022 at 09:58:23AM -0500, libresco_27 wrote:

> Hello,
> I'm trying to get the current time and date with milliseconds precision. I'm
> using lua with nginx/openresty. Can someone help?

In general, nginx can provide time with millisecond resolution.
For example, see the $msec variable (http://nginx.org/r/$msec).

Note though that precision is not the same thing as resolution.
Since nginx updates time only at the start of an event loop
iteration, and various operations, such as disk access, might take
significant time, likely precision will be worse than 1
millisecond. Further, precision might be much worse if you've
configured nginx to update time only once in a while by using the
timer_resolution directive (http://nginx.org/r/timer_resolution).

Hope this helps.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

Getting current date and time with milliseconds precision

libresco_27 November 16, 2022 09:58AM

Re: Getting current date and time with milliseconds precision

Sergey A. Osokin November 16, 2022 10:04AM

Re: Getting current date and time with milliseconds precision

Maxim Dounin November 16, 2022 01:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 281
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready