source: rtems/cpukit/rtems/src/clockset.c @ 6b5f22dc

Last change on this file since 6b5f22dc was 6b5f22dc, checked in by Sebastian Huber <sebastian.huber@…>, on 11/26/20 at 10:45:47

rtems: Canonicalize Doxygen @file comments

Use common phrases for the file brief descriptions.

Update #3706.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSImplClassicClock
5 *
6 * @brief This source file contains the implementation of
7 *   rtems_clock_set().
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-1999.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/rtems/clockimpl.h>
24#include <rtems/score/todimpl.h>
25#include <rtems/config.h>
26
27rtems_status_code rtems_clock_set(
28  const rtems_time_of_day *tod
29)
30{
31  Status_Control status;
32
33  if ( !tod )
34    return RTEMS_INVALID_ADDRESS;
35
36  if ( _TOD_Validate( tod ) ) {
37    struct timespec  tod_as_timespec;
38    ISR_lock_Context lock_context;
39
40    tod_as_timespec.tv_sec = _TOD_To_seconds( tod );
41    tod_as_timespec.tv_nsec = tod->ticks
42      * rtems_configuration_get_nanoseconds_per_tick();
43
44    _TOD_Lock();
45    _TOD_Acquire( &lock_context );
46    status = _TOD_Set( &tod_as_timespec, &lock_context );
47    _TOD_Unlock();
48
49    return STATUS_GET_CLASSIC( status );
50  }
51
52  return RTEMS_INVALID_CLOCK;
53}
Note: See TracBrowser for help on using the repository browser.