OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [posixtimespectointerval.c] - Blame information for rev 219

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: posixtimespectointerval.c,v 1.2 2001-09-27 11:59:17 chris Exp $
3
 */
4
 
5
#include <assert.h>
6
#include <time.h>
7
#include <errno.h>
8
 
9
#include <rtems/system.h>
10
#include <rtems/score/isr.h>
11
#include <rtems/score/thread.h>
12
#include <rtems/score/tod.h>
13
 
14
#include <rtems/posix/seterr.h>
15
#include <rtems/posix/time.h>
16
 
17
/*PAGE
18
 *
19
 *  _POSIX_Timespec_to_interval
20
 */
21
 
22
Watchdog_Interval _POSIX_Timespec_to_interval(
23
  const struct timespec *time
24
)
25
{
26
  Watchdog_Interval  ticks;
27
 
28
  ticks  = (time->tv_sec * TOD_MICROSECONDS_PER_SECOND) /
29
             _TOD_Microseconds_per_tick;
30
 
31
  ticks += (time->tv_nsec / TOD_NANOSECONDS_PER_MICROSECOND) /
32
             _TOD_Microseconds_per_tick;
33
 
34
  if (ticks)
35
    return ticks;
36
 
37
  return 1;
38
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.