Hello,
I am building my own NGINX module, when I try to set the last modified
out
header I have a struct timespec which I need to convert to last
modified.
When I set the last modified with the tv_sec the last modified get
invalid
date.
On Wed, Feb 10, 2016 at 03:44:13AM -0500, Ortal wrote:
Hello,
I am building my own NGINX module, when I try to set the last modified out
header I have a struct timespec which I need to convert to last modified.
When I set the last modified with the tv_sec the last modified get invalid
date.
How can I set the last modified correctly?
The “struct timespec” is not guaranteed to contain time since any
specific point in the past. So the question is: how did you got
the struct timespec?
E.g., when using clock_gettime(CLOCK_REALTIME), tv_sec is expected
to contain seconds since the Epoch, and it should work fine. But
when using clock_gettime(CLOCK_MONOTONIC) tv_sec is “since an
unspecified point in the past” (quoting POSIX, see [1]), and it’s
not possible to convert it to time since the Epoch as required by
r->headers_out.last_modified_time.