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

4.104.114.84.95
Last change on this file since bd83f47 was bd83f47, checked in by Joel Sherrill <joel.sherrill@…>, on May 17, 1999 at 10:42:47 PM

Split Clock Manager into one routine per file.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  Clock Manager
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
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.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/rtems/status.h>
17#include <rtems/rtems/clock.h>
18#include <rtems/score/isr.h>
19#include <rtems/score/thread.h>
20#include <rtems/score/tod.h>
21#include <rtems/score/watchdog.h>
22
23/*PAGE
24 *
25 *  rtems_clock_set
26 *
27 *  This directive sets the date and time for this node.
28 *
29 *  Input parameters:
30 *    time_buffer - pointer to the time and date structure
31 *
32 *  Output parameters:
33 *    RTEMS_SUCCESSFUL - if successful
34 *    error code        - if unsuccessful
35 */
36
37rtems_status_code rtems_clock_set(
38  rtems_time_of_day *time_buffer
39)
40{
41  rtems_interval     seconds;
42
43  if ( _TOD_Validate( time_buffer ) ) {
44    seconds = _TOD_To_seconds( time_buffer );
45    _Thread_Disable_dispatch();
46      _TOD_Set( time_buffer, seconds );
47    _Thread_Enable_dispatch();
48    return RTEMS_SUCCESSFUL;
49  }
50  return RTEMS_INVALID_CLOCK;
51}
Note: See TracBrowser for help on using the repository browser.