From 7deaa4a49b1d0fb2112a69719141709b9c261c7c Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 21 Aug 2024 16:05:07 +0800
Subject: [PATCH] Update leds source code

---
 booster/util_proc.h |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/booster/util_proc.h b/booster/util_proc.h
index 4af3cf2..89856c6 100644
--- a/booster/util_proc.h
+++ b/booster/util_proc.h
@@ -15,6 +15,7 @@
 #define __UTIL_PROC_H_
 
 #include <signal.h>
+#include <time.h>
 
 #define PID_ASCII_SIZE  11
 
@@ -59,9 +60,30 @@
  * |   Low level API     |
  * +---------------------+*/
 
-
-
 /* get daemon process ID from $pid_file   */
 extern pid_t get_daemon_pid(const char *pid_file);
 
+/* +------------------------+
+ * |  inline functions API  |
+ * +------------------------+*/
+static inline void msleep(unsigned long ms)
+{
+    struct timespec cSleep;
+    unsigned long ulTmp;
+
+    cSleep.tv_sec = ms / 1000;
+    if (cSleep.tv_sec == 0)
+    {
+        ulTmp = ms * 10000;
+        cSleep.tv_nsec = ulTmp * 100;
+    }
+    else
+    {
+        cSleep.tv_nsec = 0;
+    }
+
+    nanosleep(&cSleep, 0);
+    return ;
+}
+
 #endif

--
Gitblit v1.9.1