lighttpd 1.4.x
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.3 KiB

* sys-time.h - time.h wrapper for localtime_r() and gmtime_r()
* Copyright(c) 2015 Glenn Strauss gstrauss() All rights reserved
* License: BSD 3-clause (same as lighttpd)
/* _XOPEN_SOURCE for strptime() */
#define _XOPEN_SOURCE 700
#include "first.h"
#include <sys/time.h>/* gettimeofday() */
#include <time.h> /* time() localtime_r() gmtime_r() strftime() strptime() */
/*(provide rudimentary localtime_r() and gmtime_r() for platforms lacking)
*(Note that 'result' preprocessor arg is repeated, so callers should avoid
* side-effects. Also note that there is still a race condition before the
* result of localtime()/gmtime() is copied. In any case, this exists here
* so that the rest of the code can use localtime_r() and gmtime_r() syntax.
* Platforms requiring thread-safety and lacking localtime_r() or gmtime_r()
* could turn these into subroutines which take a local mutex to protect the
* calls to localtime() or gmtime()) */
#define localtime_r(timep,result) ((*(result) = *(localtime(timep))), (result))
#define gmtime_r(timep,result) ((*(result) = *(gmtime(timep))), (result))