Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2007 Pekka Riikonen
+ Copyright (C) 1997 - 2008 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
-#include "silc.h"
+#include "silcruntime.h"
/* Returns the username of the user. If the global variable LOGNAME
does not exists we will get the name from the password file. */
int silc_gettimeofday(struct timeval *p)
{
+#if defined(HAVE_CLOCK_GETTIME)
+ struct timespec tp;
+ if (clock_gettime(CLOCK_REALTIME, &tp))
+ return -1;
+ p->tv_sec = tp.tv_sec;
+ p->tv_usec = tp.tv_nsec / 1000;
+ return 0;
+#else
return gettimeofday(p, NULL);
+#endif /* HAVE_CLOCK_GETTIME */
}
int silc_file_set_nonblock(int fd)