Set last modified out header

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?

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,264458,264458#msg-264458

Hello!

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.

[1]
http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html


Maxim D.
http://nginx.org/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs