summaryrefslogtreecommitdiffstats
path: root/src/os_time.h
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2015-12-13 17:18:02 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2015-12-13 17:18:02 +0200
commit9738e267d806223ee25e013b5959ccac26c1a14a (patch)
tree590c8f329f2ab68c7da3f1f8f4c55f81243a08bc /src/os_time.h
parenta573adc6395c9ad8d96978508a07a654ef48c7a9 (diff)
parent301341ddb1bf17387d7fea19667bedd40fce4509 (diff)
Merge branch 'master' into get_logs_and_version
Diffstat (limited to 'src/os_time.h')
-rwxr-xr-xsrc/os_time.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/os_time.h b/src/os_time.h
index 153ee3e3..0e732abf 100755
--- a/src/os_time.h
+++ b/src/os_time.h
@@ -22,6 +22,7 @@ limitations under the License.
*/
#include <stdint.h>
+#include <time.h>
typedef uint64_t hr_time_t; // time in high res tick
typedef uint32_t hr_time_32_t; // time in high res tick
@@ -129,6 +130,25 @@ static inline dsec_t now_sec(void){
}
+static inline
+void delay(int msec){
+
+ if (msec == 0)
+ {//user that requested that probebly wanted the minimal delay
+ //but because of scaling problem he have got 0 so we will give the min delay
+ //printf("\n\n\nERROR-Task delay ticks == 0 found in task %s task id = %d\n\n\n\n",
+ // SANB_TaskName(SANB_TaskIdSelf()), SANB_TaskIdSelf());
+ msec =1;
+
+ }
+
+ struct timespec time1, remain; // 2 sec max delay
+ time1.tv_sec=msec/1000;
+ time1.tv_nsec=(msec - (time1.tv_sec*1000))*1000000;
+
+ nanosleep(&time1,&remain);
+}
+
#endif