View | Details | Raw Unified | Return to bug 2228 | Differences between
and this patch

Collapse All | Expand All

(-)misc.c (-2 / +7 lines)
Lines 858-874 ms_to_timeval(struct timeval *tv, int ms Link Here
858
time_t
858
time_t
859
monotime(void)
859
monotime(void)
860
{
860
{
861
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
861
#if defined(HAVE_CLOCK_GETTIME) && \
862
    (defined(CLOCK_MONOTONIC) || defined(CLOCK_BOOTTIME))
862
	struct timespec ts;
863
	struct timespec ts;
863
	static int gettime_failed = 0;
864
	static int gettime_failed = 0;
864
865
865
	if (!gettime_failed) {
866
	if (!gettime_failed) {
867
#if defined(CLOCK_BOOTTIME)
868
		if (clock_gettime(CLOCK_BOOTTIME, &ts) == 0)
869
			return (ts.tv_sec);
870
#endif
866
		if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
871
		if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
867
			return (ts.tv_sec);
872
			return (ts.tv_sec);
868
		debug3("clock_gettime: %s", strerror(errno));
873
		debug3("clock_gettime: %s", strerror(errno));
869
		gettime_failed = 1;
874
		gettime_failed = 1;
870
	}
875
	}
871
#endif
876
#endif /* HAVE_CLOCK_GETTIME && (CLOCK_MONOTONIC || CLOCK_BOOTTIME */
872
877
873
	return time(NULL);
878
	return time(NULL);
874
}
879
}

Return to bug 2228