4.115
Last change
on this file since 8d7aea0d was
8d7aea0d,
checked in by Sebastian Huber <sebastian.huber@…>, on 09/29/11 at 09:55:54
|
2011-09-29 Sebastian Huber <sebastian.huber@…>
- score/include/rtems/score/tod.h: Declare _TOD_Set_with_timestamp()
and _TOD_Get_as_timestamp().
- score/src/coretodset.c: Define _TOD_Set_with_timestamp().
- score/src/coretodget.c: Define _TOD_Get_as_timestamp().
- rtems/src/clockset.c: Use _TOD_Set_with_timestamp().
- score/include/rtems/score/timestamp64.h, score/src/ts64set.c:
Changed parameter types of _Timestamp64_Set().
- rtems/src/clocktodtoseconds.c: Year 2100 is not a leap year.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /* |
---|
2 | * Time of Day (TOD) Handler -- Set Time |
---|
3 | */ |
---|
4 | |
---|
5 | /* COPYRIGHT (c) 1989-2007. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #if HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/system.h> |
---|
20 | #include <rtems/score/object.h> |
---|
21 | #include <rtems/score/thread.h> |
---|
22 | #include <rtems/score/timestamp.h> |
---|
23 | #include <rtems/score/tod.h> |
---|
24 | #include <rtems/score/watchdog.h> |
---|
25 | |
---|
26 | void _TOD_Set_with_timestamp( |
---|
27 | const Timestamp_Control *tod |
---|
28 | ) |
---|
29 | { |
---|
30 | Watchdog_Interval seconds_next = _Timestamp_Get_seconds( tod ); |
---|
31 | Watchdog_Interval seconds_now; |
---|
32 | |
---|
33 | _Thread_Disable_dispatch(); |
---|
34 | _TOD_Deactivate(); |
---|
35 | |
---|
36 | seconds_now = _TOD_Seconds_since_epoch(); |
---|
37 | |
---|
38 | if ( seconds_next < seconds_now ) |
---|
39 | _Watchdog_Adjust_seconds( WATCHDOG_BACKWARD, seconds_now - seconds_next ); |
---|
40 | else |
---|
41 | _Watchdog_Adjust_seconds( WATCHDOG_FORWARD, seconds_next - seconds_now ); |
---|
42 | |
---|
43 | _TOD_Now = *tod; |
---|
44 | _TOD_Is_set = true; |
---|
45 | |
---|
46 | _TOD_Activate(); |
---|
47 | _Thread_Enable_dispatch(); |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.