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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [posixtimespectointerval.c] - Rev 738

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

/*
 *  $Id: posixtimespectointerval.c,v 1.2 2001-09-27 11:59:17 chris Exp $
 */
 
#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/posix/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;
}
 

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

powered by: WebSVN 2.1.0

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