source: rtems/cpukit/rtems/src/clockset.c @ a29d2e7

4.104.114.84.95
Last change on this file since a29d2e7 was 1095ec1, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/18/05 at 09:03:45

Include config.h.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  Clock Manager
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/rtems/status.h>
20#include <rtems/rtems/clock.h>
21#include <rtems/score/isr.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/tod.h>
24#include <rtems/score/watchdog.h>
25
26/*PAGE
27 *
28 *  rtems_clock_set
29 *
30 *  This directive sets the date and time for this node.
31 *
32 *  Input parameters:
33 *    time_buffer - pointer to the time and date structure
34 *
35 *  Output parameters:
36 *    RTEMS_SUCCESSFUL - if successful
37 *    error code        - if unsuccessful
38 */
39
40rtems_status_code rtems_clock_set(
41  rtems_time_of_day *time_buffer
42)
43{
44  rtems_interval     seconds;
45
46  if ( !time_buffer )
47    return RTEMS_INVALID_ADDRESS;
48
49  if ( _TOD_Validate( time_buffer ) ) {
50    seconds = _TOD_To_seconds( time_buffer );
51    _Thread_Disable_dispatch();
52      _TOD_Set( time_buffer, seconds );
53    _Thread_Enable_dispatch();
54    return RTEMS_SUCCESSFUL;
55  }
56  return RTEMS_INVALID_CLOCK;
57}
Note: See TracBrowser for help on using the repository browser.