posixtimespectointerval.c

来自「RTEMS (Real-Time Executive for Multiproc」· C语言 代码 · 共 43 行

C
43
字号
/* *  $Id: posixtimespectointerval.c,v 1.3 2001/01/24 14:17:28 joel Exp $ */#if HAVE_CONFIG_H#include "config.h"#endif#include <assert.h>#include <time.h>#include <errno.h>#include <rtems/system.h>#include <rtems/score/isr.h>#include <rtems/score/thread.h>#include <rtems/score/tod.h>#include <rtems/seterr.h>#include <rtems/posix/time.h>/*PAGE * *  _POSIX_Timespec_to_interval */Watchdog_Interval _POSIX_Timespec_to_interval(  const struct timespec *time){  Watchdog_Interval  ticks;  ticks  = (time->tv_sec * TOD_MICROSECONDS_PER_SECOND) /              _TOD_Microseconds_per_tick;  ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /              _TOD_Microseconds_per_tick;  if (ticks)    return ticks;  return 1;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?