4.115
Last change
on this file since 2d7ae960 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:
1.2 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file score/src/timespecdivide.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 | |
---|
23 | void _Timespec_Divide( |
---|
24 | const struct timespec *lhs, |
---|
25 | const struct timespec *rhs, |
---|
26 | uint32_t *ival_percentage, |
---|
27 | uint32_t *fval_percentage |
---|
28 | ) |
---|
29 | { |
---|
30 | uint64_t left, right, answer; |
---|
31 | |
---|
32 | /* |
---|
33 | * For math simplicity just convert the timespec to nanoseconds |
---|
34 | * in a 64-bit integer. |
---|
35 | */ |
---|
36 | left = lhs->tv_sec * (uint64_t)TOD_NANOSECONDS_PER_SECOND; |
---|
37 | left += lhs->tv_nsec; |
---|
38 | right = rhs->tv_sec * (uint64_t)TOD_NANOSECONDS_PER_SECOND; |
---|
39 | right += rhs->tv_nsec; |
---|
40 | |
---|
41 | if ( right == 0 ) { |
---|
42 | *ival_percentage = 0; |
---|
43 | *fval_percentage = 0; |
---|
44 | return; |
---|
45 | } |
---|
46 | |
---|
47 | /* |
---|
48 | * Put it back in the timespec result. |
---|
49 | * |
---|
50 | * TODO: Rounding on the last digit of the fval. |
---|
51 | */ |
---|
52 | |
---|
53 | answer = (left * 100000) / right; |
---|
54 | |
---|
55 | *ival_percentage = answer / 1000; |
---|
56 | *fval_percentage = answer % 1000; |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.