kike: add support for IRCv3.2 server-time

This commit is contained in:
2016-01-31 20:06:45 +01:00
parent 2ec6258ff3
commit 10a264ec3d
4 changed files with 40 additions and 3 deletions

View File

@@ -52,6 +52,21 @@ str_vector_find (const struct str_vector *v, const char *s)
return -1;
}
static time_t
unixtime_msec (long *msec)
{
#ifdef _POSIX_TIMERS
struct timespec tp;
hard_assert (clock_gettime (CLOCK_REALTIME, &tp) != -1);
*msec = tp.tv_nsec / 1000000;
#else // ! _POSIX_TIMERS
struct timeval tp;
hard_assert (gettimeofday (&tp, NULL) != -1);
*msec = tp.tv_usec / 1000;
#endif // ! _POSIX_TIMERS
return tp.tv_sec;
}
/// This differs from the non-unique version in that we expect the filename
/// to be something like a pattern for mkstemp(), so the resulting path can
/// reside in a system-wide directory with no risk of a conflict.