From 10a264ec3d189ba0fc00e4c6f7b0e7e4a8043aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sun, 31 Jan 2016 20:06:45 +0100 Subject: kike: add support for IRCv3.2 server-time --- common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'common.c') diff --git a/common.c b/common.c index a92bae4..7880dee 100644 --- a/common.c +++ b/common.c @@ -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. -- cgit v1.2.3