
# Copyright (C) Igor Sysoev
# Copyright (C) NGINX, Inc.


njs_feature="clock_gettime(CLOCK_MONOTONIC)"
njs_feature_name=NJS_HAVE_CLOCK_MONOTONIC
njs_feature_run=yes
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <time.h>

                  int main() {
                      struct timespec  ts;

                      if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
                          return 1;
                      return 0;
                  }"
. auto/feature


if [ $njs_found = no ]; then

    # Linux and Solaris 10 clock_gettime() are in librt.

    njs_feature="clock_gettime(CLOCK_MONOTONIC) in librt"
    njs_feature_libs="-lrt"
    . auto/feature

    if [ $njs_found = yes ]; then
		NJS_LIBRT="-lrt"
    fi
fi


# Linux, FreeBSD, MacOSX.

njs_feature="struct tm.tm_gmtoff"
njs_feature_name=NJS_HAVE_TM_GMTOFF
njs_feature_run=no
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <time.h>

                  int main(void) {
                      time_t     t;
                      struct tm  tm;

                      t = 0;
                      localtime_r(&t, &tm);
                      return tm.tm_gmtoff;
                  }"
. auto/feature


# Solaris

njs_feature="altzone"
njs_feature_name=NJS_HAVE_ALTZONE
njs_feature_run=no
njs_feature_incs=
njs_feature_libs=
njs_feature_test="#include <time.h>

                  int main(void) {
                      altzone = 0;
                      return 0;
                  }"
. auto/feature
