Welcome! Log In Create A New Profile

Advanced

32 vs 64-bit ngx_current_msec

Peter Leonov
May 05, 2010 10:04AM
Hello,

The size of ngx_current_msec depends on the platform as far as it is typedefed via ngx_uint_t.
On the 64-bit it is enough to store the current msecs without an overflow. But on 32-bits it isn't.

At the ngx_times.c:87

ngx_current_msec = (ngx_msec_t) sec * 1000 + msec;

and it's good and usable on the 64-bit machine, but fails on the 32-bit box giving a garbled value.

One workaround I'v found is to do like so:

(uint64_t) ngx_cached_time->sec * 1000 + ngx_cached_time->msec

if the full msecs value is needed is't ok.
Is this a right way to do?

Thanks,
Peter.
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

32 vs 64-bit ngx_current_msec

Peter Leonov 2754 May 05, 2010 10:04AM

Re: 32 vs 64-bit ngx_current_msec

Igor Sysoev 1406 May 05, 2010 10:20AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 247
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