| 11065 | } |
| 11066 | |
| 11067 | static long server_decode_coalesce_us(void) { |
| 11068 | long us = 2000; |
| 11069 | const char *env = getenv("DS4_SERVER_DECODE_COALESCE_US"); |
| 11070 | if (env && env[0]) { |
| 11071 | char *end = NULL; |
| 11072 | long v = strtol(env, &end, 10); |
| 11073 | if (end != env && *end == '\0' && v >= 0 && v <= 100000) us = v; |
| 11074 | } |
| 11075 | return us; |
| 11076 | } |
| 11077 | |
| 11078 | static void timespec_add_us(struct timespec *ts, long us) { |
| 11079 | if (!ts || us <= 0) return; |
| 11080 | ts->tv_nsec += (us % 1000000L) * 1000L; |
| 11081 | ts->tv_sec += us / 1000000L + ts->tv_nsec / 1000000000L; |
| 11082 | ts->tv_nsec %= 1000000000L; |
nothing calls this directly
no test coverage detected