Moved silc_usleep from inline function to source file.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 4 Feb 2008 21:01:29 +0000 (23:01 +0200)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 4 Feb 2008 21:01:29 +0000 (23:01 +0200)
lib/silcutil/silctime.h
lib/silcutil/silctimer.c
lib/silcutil/silctimer.h

index a049cca469b0e3deca59981d539cfb373c78556a..32d4d9272d7f0a1574b8d02e9d96c91097b64765 100644 (file)
  * SOURCE
  *
  */
+/****s* silcutil/SilcTimeStruct
+ *
+ * NAME
+ *
+ *    typedef struct { ... } *SilcTime, SilcTimeStruct;
+ *
+ * DESCRIPTION
+ *
+ *    This context represents time value.  It includes date and time
+ *    down to millisecond precision.  The structure size is 64 bits.
+ *
+ * SOURCE
+ *
+ */
 typedef struct SilcTimeObject {
   unsigned int year       : 15;           /* Year,     0 - 32768 */
   unsigned int month      : 4;    /* Month,    1 - 12 */
index 049341b77d8df6c9df51306f81969ee54dc6e26e..ce1c2bf11ad75832788783ec2e2b38d0e917c386 100644 (file)
@@ -128,3 +128,30 @@ SilcBool silc_timer_is_running(SilcTimer timer)
 {
   return timer->running;
 }
+
+/* Delay execution */
+
+void silc_usleep(unsigned long microseconds)
+{
+#ifdef SILC_UNIX
+#ifdef HAVE_NANOSLEEP
+  struct timespec tv;
+  tv.tv_sec = 0;
+  tv.tv_nsec = microseconds * 1000;
+#endif /* HAVE_NANOSLEEP */
+#endif /* SILC_UNIX */
+
+#ifdef SILC_UNIX
+#ifdef HAVE_NANOSLEEP
+  nanosleep(&tv, NULL);
+#else
+  usleep(microseconds);
+#endif /* HAVE_NANOSLEEP */
+#endif /* SILC_UNIX */
+#ifdef SILC_WIN32
+  Sleep(microseconds / 1000);
+#endif /* SILC_WIN32 */
+#ifdef SILC_SYMBIAN
+  silc_symbian_usleep(microseconds);
+#endif /* SILC_SYMBIAN */
+}
index bc908ee7f1b50aaba90f74b8cb0730236aa09941..f63486941e4e59d4d2a47b9058bbab62a88666d8 100644 (file)
  *    silc_timer_* functions.
  *
  ***/
+/****s* silcutil/SilcTimerStruct
+ *
+ * NAME
+ *
+ *    typedef struct SilcTimerObject *SilcTimer, SilcTimerStruct;
+ *
+ * DESCRIPTION
+ *
+ *    The timer context.  The context is given as argument to all
+ *    silc_timer_* functions.
+ *
+ ***/
 typedef struct SilcTimerObject *SilcTimer, SilcTimerStruct;
 
 /****f* silcutil/silc_timer_start
@@ -219,6 +231,9 @@ SilcUInt64 silc_timer_tick(SilcTimer timer, SilcBool adjust)
                 : "=r" (hi), "=r" (lo), "=r" (tmp));
   x = ((SilcUInt64)lo | ((SilcUInt64)hi << 32));
   return adjust ? x - timer->sync_tdiff : x;
+
+#else
+  return 0;
 #endif /* SILC_I486 */
 
 #elif defined(SILC_WIN32)
@@ -306,30 +321,6 @@ void silc_timer_synchronize(SilcTimer timer)
  *    in fact milliseconds.
  *
  ***/
-static inline
-void silc_usleep(unsigned long microseconds)
-{
-#ifdef SILC_UNIX
-#ifdef HAVE_NANOSLEEP
-  struct timespec tv;
-  tv.tv_sec = 0;
-  tv.tv_nsec = microseconds * 1000;
-#endif /* HAVE_NANOSLEEP */
-#endif /* SILC_UNIX */
-
-#ifdef SILC_UNIX
-#ifdef HAVE_NANOSLEEP
-  nanosleep(&tv, NULL);
-#else
-  usleep(microseconds);
-#endif /* HAVE_NANOSLEEP */
-#endif /* SILC_UNIX */
-#ifdef SILC_WIN32
-  Sleep(microseconds / 1000);
-#endif /* SILC_WIN32 */
-#ifdef SILC_SYMBIAN
-  silc_symbian_usleep(microseconds);
-#endif /* SILC_SYMBIAN */
-}
+void silc_usleep(unsigned long microseconds);
 
 #endif /* SILCTIMER_H */