clogger RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
blob ec635b1986a93d132a1bc354d806aa644f493eef 848 bytes (raw)
name: ext/clogger_ext/broken_system_compat.h 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
/*
 * this header includes functions to support broken systems
 * without clock_gettime() or CLOCK_MONOTONIC
 */

#ifndef HAVE_TYPE_CLOCKID_T
typedef clockid_t int;
#endif

#ifndef HAVE_CLOCK_GETTIME
#  ifndef CLOCK_REALTIME
#    define CLOCK_REALTIME 0 /* whatever */
#  endif
static int fake_clock_gettime(clockid_t clk_id, struct timespec *res)
{
	struct timeval tv;
	int r = gettimeofday(&tv, NULL);

	assert(0 == r && "gettimeofday() broke!?");
	res->tv_sec = tv.tv_sec;
	res->tv_nsec = tv.tv_usec * 1000;

	return r;
}
#  define clock_gettime fake_clock_gettime
#endif /* broken systems w/o clock_gettime() */

/*
 * UGH
 * CLOCK_MONOTONIC is not guaranteed to be a macro, either
 */
#ifndef CLOCK_MONOTONIC
#  if (!defined(_POSIX_MONOTONIC_CLOCK) || !defined(HAVE_CLOCK_MONOTONIC))
#    define CLOCK_MONOTONIC CLOCK_REALTIME
#  endif
#endif

debug log:

solving ec635b1 ...
found ec635b1 in https://yhbt.net/clogger.git/

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/clogger.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).