source: rtems/cpukit/score/src/timespecaddto.c @ 62181b21

4.115
Last change on this file since 62181b21 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: 1019 bytes
Line 
1/**
2 *  @file  score/src/timespecaddto.c
3 */
4
5/*
6 *  COPYRIGHT (c) 1989-2008.
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
24/**
25 *
26 *  This routines adds two timespecs.  The second argument is added
27 *  to the first.
28 */
29
30uint32_t _Timespec_Add_to(
31  struct timespec       *time,
32  const struct timespec *add
33)
34{
35  uint32_t seconds = add->tv_sec;
36
37  /* Add the basics */
38  time->tv_sec += add->tv_sec;
39  time->tv_nsec += add->tv_nsec;
40
41  /* Now adjust it so nanoseconds is in range */
42  while ( time->tv_nsec >= TOD_NANOSECONDS_PER_SECOND ) {
43    time->tv_nsec -= TOD_NANOSECONDS_PER_SECOND;
44    time->tv_sec++;
45    seconds++;
46  }
47
48  return seconds;
49}
Note: See TracBrowser for help on using the repository browser.