Use timegm() instead of mktime() to generate UNIX-timestamp - quark - quark web server
 (HTM) git clone git://git.suckless.org/quark
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 660b3086172c653fa65b1e2bddd3ce99863f30d9
 (DIR) parent a55df3915dad471ee0629262e950aefc43b8dbad
 (HTM) Author: Laslo Hunhold <dev@frign.de>
       Date:   Thu, 23 Jul 2020 16:48:34 +0200
       
       Use timegm() instead of mktime() to generate UNIX-timestamp
       
       The broken down time-representation tm generated earlier is in UTC,
       and mktime() assumes that it's in local time instead, leading to
       the problem that quark might not send a NOT_MODIFIED in a different
       timezone.
       
       timegm() instead correctly interprets the broken down
       time-representation tm as UTC and returns the proper timestamp.
       It might not be portable like mktime(), but it's complicated to
       emulate it otherwise.
       
       Thanks to Jeremy Bobbin <jer@jer.cx> for reporting the bug and
       providing this fix, which is why I've added him to the LICENSE.
       Thanks also to Hiltjo for his input.
       
       Signed-off-by: Laslo Hunhold <dev@frign.de>
       
       Diffstat:
         M LICENSE                             |       1 +
         M http.c                              |       2 +-
       
       2 files changed, 2 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/LICENSE b/LICENSE
       @@ -12,6 +12,7 @@ Copyright 2018 Dominik Schmidt <domischmidt@swissonline.ch>
        Copyright 2018 Aaron Burrow <burrows@charstarstar.com>
        Copyright 2020 Nihal Jere <nihal@nihaljere.xyz>
        Copyright 2020 Rainer Holzner <rholzner@web.de>
       +Copyright 2020 Jeremy Bobbin <jer@jer.cx>
        
        Permission to use, copy, modify, and/or distribute this software for any
        purpose with or without fee is hereby granted, provided that the above
 (DIR) diff --git a/http.c b/http.c
       @@ -531,7 +531,7 @@ http_send_response(int fd, struct request *r)
                        }
        
                        /* compare with last modification date of the file */
       -                if (difftime(st.st_mtim.tv_sec, mktime(&tm)) <= 0) {
       +                if (difftime(st.st_mtim.tv_sec, timegm(&tm)) <= 0) {
                                if (dprintf(fd,
                                            "HTTP/1.1 %d %s\r\n"
                                            "Date: %s\r\n"