ngx_msec_t is 32bit on ARM

teknopaul nginx-forum at
Sun Nov 26 00:44:54 UTC 2017

I'm trying to compile nginx on for a raspberry pi


    time_t           sec;
    ngx_uint_t       msec;
    struct timeval   tv;

    sec = tv.tv_sec;
    msec = tv.tv_usec / 1000;
    ngx_current_msec = (ngx_msec_t) sec * 1000 + msec;

ngx_current_msec is defined as a ngx_msec_t which in turn is ngx_uint_t. In
an rpi is not big enough to hold Unix epoc in millis. (sec * 1000)

nginx code does compile, but my tests fail: they have hardcoded values for
the epoc.

Is this deliberate? I guess its cropping the high order bits?  So millis
comparisons might work but timestamps generated from this value might not?

Posted at Nginx Forum:,277514,277514#msg-277514

More information about the nginx mailing list