source: rtems/cpukit/score/src/timespecsubtract.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 923 bytes
Line 
1/**
2 *  @file  score/src/timespecsubtract.c
3 */
4
5/*
6 *  COPYRIGHT (c) 1989-2007.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <sys/types.h>
20#include <rtems/score/timespec.h>
21#include <rtems/score/tod.h>
22#include <rtems/score/watchdog.h>
23
24void _Timespec_Subtract(
25  const struct timespec *start,
26  const struct timespec *end,
27  struct timespec       *result
28)
29{
30
31  if (end->tv_nsec < start->tv_nsec) {
32    result->tv_sec  = end->tv_sec - start->tv_sec - 1;
33    result->tv_nsec =
34      (TOD_NANOSECONDS_PER_SECOND - start->tv_nsec) + end->tv_nsec;
35  } else {
36    result->tv_sec  = end->tv_sec - start->tv_sec;
37    result->tv_nsec = end->tv_nsec - start->tv_nsec;
38  }
39}
Note: See TracBrowser for help on using the repository browser.