source: rtems-docs/c-user/clock/directives.rst @ 838b78a

Last change on this file since 838b78a was 838b78a, checked in by Sebastian Huber <sebastian.huber@…>, on 11/23/21 at 14:20:06

c-user: Replace "precision" with "resolution"

Resolution is the right term for the documented property.

  • Property mode set to 100644
File size: 42.7 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 2014, 2021 embedded brains GmbH (http://www.embedded-brains.de)
4.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
5
6.. This file is part of the RTEMS quality process and was automatically
7.. generated.  If you find something that needs to be fixed or
8.. worded better please post a report or patch to an RTEMS mailing list
9.. or raise a bug report:
10..
11.. https://www.rtems.org/bugs.html
12..
13.. For information on updating and regenerating please refer to the How-To
14.. section in the Software Requirements Engineering chapter of the
15.. RTEMS Software Engineering manual.  The manual is provided as a part of
16.. a release.  For development sources please refer to the online
17.. documentation at:
18..
19.. https://docs.rtems.org
20
21.. _ClockManagerDirectives:
22
23Directives
24==========
25
26This section details the directives of the Clock Manager. A subsection is
27dedicated to each of this manager's directives and lists the calling sequence,
28parameters, description, return values, and notes of the directive.
29
30.. Generated from spec:/rtems/clock/if/set
31
32.. raw:: latex
33
34    \clearpage
35
36.. index:: rtems_clock_set()
37
38.. _InterfaceRtemsClockSet:
39
40rtems_clock_set()
41-----------------
42
43Sets the :term:`CLOCK_REALTIME` to the time of day.
44
45.. rubric:: CALLING SEQUENCE:
46
47.. code-block:: c
48
49    rtems_status_code rtems_clock_set( const rtems_time_of_day *time_of_day );
50
51.. rubric:: PARAMETERS:
52
53``time_of_day``
54    This parameter is the time of day to set the clock.
55
56.. rubric:: RETURN VALUES:
57
58:c:macro:`RTEMS_SUCCESSFUL`
59    The requested operation was successful.
60
61:c:macro:`RTEMS_INVALID_ADDRESS`
62    The ``time_of_day`` parameter was `NULL
63    <https://en.cppreference.com/w/c/types/NULL>`_.
64
65:c:macro:`RTEMS_INVALID_CLOCK`
66    The time of day specified by ``time_of_day`` was invalid.
67
68.. rubric:: NOTES:
69
70The date, time, and ticks specified by ``time_of_day`` are all range-checked,
71and an error is returned if any one is out of its valid range.
72
73RTEMS can represent time points of the :term:`CLOCK_REALTIME` clock in
74nanoseconds ranging from 1988-01-01T00:00:00.000000000Z to
752514-05-31T01:53:03.999999999Z.  The future uptime of the system shall be in
76this range, otherwise the system behaviour is undefined.  Due to implementation
77constraints, the time of day set by the directive shall be before
782100-01-01:00:00.000000000Z.  The latest valid time of day accepted by the
79POSIX `clock_settime()
80<https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_settime.html>`_
81is 2400-01-01T00:00:00.999999999Z.
82
83The specified time is based on the configured :term:`clock tick` rate, see the
84:ref:`CONFIGURE_MICROSECONDS_PER_TICK` application configuration option.
85
86Setting the time forward will fire all :term:`CLOCK_REALTIME` timers which are
87scheduled at a time point before or at the time set by the directive.  This may
88unblock tasks, which may preempt the calling task. User-provided timer routines
89will execute in the context of the caller.
90
91It is allowed to call this directive from within interrupt context, however,
92this is not recommended since an arbitrary number of timers may fire.
93
94The directive shall be called at least once to enable the service of
95:term:`CLOCK_REALTIME` related directives.  If the clock is not set at least
96once, they may return an error status.
97
98.. rubric:: CONSTRAINTS:
99
100The following constraints apply to this directive:
101
102* The directive may be called from within any runtime context.
103
104* The directive may change the priority of a task.  This may cause the calling
105  task to be preempted.
106
107* The directive may unblock a task.  This may cause the calling task to be
108  preempted.
109
110* The time of day set by the directive shall be 1988-01-01T00:00:00.000000000Z
111  or later.
112
113* The time of day set by the directive shall be before
114  2100-01-01T00:00:00.000000000Z.
115
116.. Generated from spec:/rtems/clock/if/get-tod
117
118.. raw:: latex
119
120    \clearpage
121
122.. index:: rtems_clock_get_tod()
123
124.. _InterfaceRtemsClockGetTod:
125
126rtems_clock_get_tod()
127---------------------
128
129Gets the time of day associated with the current :term:`CLOCK_REALTIME`.
130
131.. rubric:: CALLING SEQUENCE:
132
133.. code-block:: c
134
135    rtems_status_code rtems_clock_get_tod( rtems_time_of_day *time_of_day );
136
137.. rubric:: PARAMETERS:
138
139``time_of_day``
140    This parameter is the pointer to an :c:type:`rtems_time_of_day` object.
141    When the directive call is successful, the time of day associated with the
142    :term:`CLOCK_REALTIME` at some point during the directive call will be
143    stored in this object.
144
145.. rubric:: RETURN VALUES:
146
147:c:macro:`RTEMS_SUCCESSFUL`
148    The requested operation was successful.
149
150:c:macro:`RTEMS_INVALID_ADDRESS`
151    The ``time_of_day`` parameter was `NULL
152    <https://en.cppreference.com/w/c/types/NULL>`_.
153
154:c:macro:`RTEMS_NOT_DEFINED`
155    The :term:`CLOCK_REALTIME` was not set.  It can be set with
156    :ref:`InterfaceRtemsClockSet`.
157
158.. rubric:: CONSTRAINTS:
159
160The following constraints apply to this directive:
161
162* The directive may be called from within any runtime context.
163
164* The directive will not cause the calling task to be preempted.
165
166* The directive requires a :term:`Clock Driver`.
167
168.. Generated from spec:/rtems/clock/if/get-tod-timeval
169
170.. raw:: latex
171
172    \clearpage
173
174.. index:: rtems_clock_get_tod_timeval()
175
176.. _InterfaceRtemsClockGetTodTimeval:
177
178rtems_clock_get_tod_timeval()
179-----------------------------
180
181Gets the seconds and microseconds elapsed since the :term:`Unix epoch` and the
182current :term:`CLOCK_REALTIME`.
183
184.. rubric:: CALLING SEQUENCE:
185
186.. code-block:: c
187
188    rtems_status_code rtems_clock_get_tod_timeval( struct timeval *time_of_day );
189
190.. rubric:: PARAMETERS:
191
192``time_of_day``
193    This parameter is the pointer to a `struct timeval
194    <https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html>`_
195    object.  When the directive call is successful, the seconds and
196    microseconds elapsed since the :term:`Unix epoch` and the
197    :term:`CLOCK_REALTIME` at some point during the directive call will be
198    stored in this object.
199
200.. rubric:: RETURN VALUES:
201
202:c:macro:`RTEMS_SUCCESSFUL`
203    The requested operation was successful.
204
205:c:macro:`RTEMS_INVALID_ADDRESS`
206    The ``time_of_day`` parameter was `NULL
207    <https://en.cppreference.com/w/c/types/NULL>`_.
208
209:c:macro:`RTEMS_NOT_DEFINED`
210    The :term:`CLOCK_REALTIME` was not set.  It can be set with
211    :ref:`InterfaceRtemsClockSet`.
212
213.. rubric:: CONSTRAINTS:
214
215The following constraints apply to this directive:
216
217* The directive may be called from within any runtime context.
218
219* The directive will not cause the calling task to be preempted.
220
221* The directive requires a :term:`Clock Driver`.
222
223.. Generated from spec:/rtems/clock/if/get-realtime
224
225.. raw:: latex
226
227    \clearpage
228
229.. index:: rtems_clock_get_realtime()
230
231.. _InterfaceRtemsClockGetRealtime:
232
233rtems_clock_get_realtime()
234--------------------------
235
236Gets the time elapsed since the :term:`Unix epoch` measured using
237:term:`CLOCK_REALTIME` in seconds and nanoseconds format.
238
239.. rubric:: CALLING SEQUENCE:
240
241.. code-block:: c
242
243    void rtems_clock_get_realtime( struct timespec *time_snapshot );
244
245.. rubric:: PARAMETERS:
246
247``time_snapshot``
248    This parameter is the pointer to a `struct timespec
249    <https://en.cppreference.com/w/c/chrono/timespec>`_ object.  The time
250    elapsed since the :term:`Unix epoch` measured using the
251    :term:`CLOCK_REALTIME` at some time point during the directive call will be
252    stored in this object.  Calling the directive with a pointer equal to `NULL
253    <https://en.cppreference.com/w/c/types/NULL>`_ is undefined behaviour.
254
255.. rubric:: NOTES:
256
257The directive accesses a device provided by the :term:`Clock Driver` to get the
258time in the highest resolution available to the system.  Alternatively, the
259:ref:`InterfaceRtemsClockGetRealtimeCoarse` directive may be used to get the
260time in a lower resolution and with less runtime overhead.
261
262See :ref:`InterfaceRtemsClockGetRealtimeBintime` and
263:ref:`InterfaceRtemsClockGetRealtimeTimeval` to get the time in alternative
264formats.
265
266.. rubric:: CONSTRAINTS:
267
268The following constraints apply to this directive:
269
270* The directive may be called from within any runtime context.
271
272* The directive will not cause the calling task to be preempted.
273
274* The directive requires a :term:`Clock Driver`.
275
276.. Generated from spec:/rtems/clock/if/get-realtime-bintime
277
278.. raw:: latex
279
280    \clearpage
281
282.. index:: rtems_clock_get_realtime_bintime()
283
284.. _InterfaceRtemsClockGetRealtimeBintime:
285
286rtems_clock_get_realtime_bintime()
287----------------------------------
288
289Gets the time elapsed since the :term:`Unix epoch` measured using
290:term:`CLOCK_REALTIME` in binary time format.
291
292.. rubric:: CALLING SEQUENCE:
293
294.. code-block:: c
295
296    void rtems_clock_get_realtime_bintime( struct bintime *time_snapshot );
297
298.. rubric:: PARAMETERS:
299
300``time_snapshot``
301    This parameter is the pointer to a :c:type:`bintime` object.  The time
302    elapsed since the :term:`Unix epoch` measured using the
303    :term:`CLOCK_REALTIME` at some time point during the directive call will be
304    stored in this object.  Calling the directive with a pointer equal to `NULL
305    <https://en.cppreference.com/w/c/types/NULL>`_ is undefined behaviour.
306
307.. rubric:: NOTES:
308
309The directive accesses a device provided by the :term:`Clock Driver` to get the
310time in the highest resolution available to the system.  Alternatively, the
311:ref:`InterfaceRtemsClockGetRealtimeCoarseBintime` directive may be used to get
312the time in a lower resolution and with less runtime overhead.
313
314See :ref:`InterfaceRtemsClockGetRealtime` and
315:ref:`InterfaceRtemsClockGetRealtimeTimeval` to get the time in alternative
316formats.
317
318.. rubric:: CONSTRAINTS:
319
320The following constraints apply to this directive:
321
322* The directive may be called from within any runtime context.
323
324* The directive will not cause the calling task to be preempted.
325
326* The directive requires a :term:`Clock Driver`.
327
328.. Generated from spec:/rtems/clock/if/get-realtime-timeval
329
330.. raw:: latex
331
332    \clearpage
333
334.. index:: rtems_clock_get_realtime_timeval()
335
336.. _InterfaceRtemsClockGetRealtimeTimeval:
337
338rtems_clock_get_realtime_timeval()
339----------------------------------
340
341Gets the time elapsed since the :term:`Unix epoch` measured using
342:term:`CLOCK_REALTIME` in seconds and microseconds format.
343
344.. rubric:: CALLING SEQUENCE:
345
346.. code-block:: c
347
348    void rtems_clock_get_realtime_timeval( struct timeval *time_snapshot );
349
350.. rubric:: PARAMETERS:
351
352``time_snapshot``
353    This parameter is the pointer to a `struct timeval
354    <https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html>`_
355    object.  The time elapsed since the :term:`Unix epoch` measured using the
356    :term:`CLOCK_REALTIME` at some time point during the directive call will be
357    stored in this object.  Calling the directive with a pointer equal to `NULL
358    <https://en.cppreference.com/w/c/types/NULL>`_ is undefined behaviour.
359
360.. rubric:: NOTES:
361
362The directive accesses a device provided by the :term:`Clock Driver` to get the
363time in the highest resolution available to the system.  Alternatively, the
364:ref:`InterfaceRtemsClockGetRealtimeCoarseTimeval` directive may be used to get
365the time in a lower resolution and with less runtime overhead.
366
367See :ref:`InterfaceRtemsClockGetRealtime` and
368:ref:`InterfaceRtemsClockGetRealtimeBintime` to get the time in alternative
369formats.
370
371.. rubric:: CONSTRAINTS:
372
373The following constraints apply to this directive:
374
375* The directive may be called from within any runtime context.
376
377* The directive will not cause the calling task to be preempted.
378
379* The directive requires a :term:`Clock Driver`.
380
381.. Generated from spec:/rtems/clock/if/get-realtime-coarse
382
383.. raw:: latex
384
385    \clearpage
386
387.. index:: rtems_clock_get_realtime_coarse()
388
389.. _InterfaceRtemsClockGetRealtimeCoarse:
390
391rtems_clock_get_realtime_coarse()
392---------------------------------
393
394Gets the time elapsed since the :term:`Unix epoch` measured using
395:term:`CLOCK_REALTIME` in coarse resolution in seconds and nanoseconds format.
396
397.. rubric:: CALLING SEQUENCE:
398
399.. code-block:: c
400
401    void rtems_clock_get_realtime_coarse( struct timespec *time_snapshot );
402
403.. rubric:: PARAMETERS:
404
405``time_snapshot``
406    This parameter is the pointer to a `struct timespec
407    <https://en.cppreference.com/w/c/chrono/timespec>`_ object.  The time
408    elapsed since the :term:`Unix epoch` measured using the
409    :term:`CLOCK_REALTIME` at some time point close to the directive call will
410    be stored in this object.  Calling the directive with a pointer equal to
411    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
412    behaviour.
413
414.. rubric:: NOTES:
415
416The directive does not access a device to get the time.  It uses a recent
417snapshot provided by the :term:`Clock Driver`.  Alternatively, the
418:ref:`InterfaceRtemsClockGetRealtime` directive may be used to get the time in
419a higher resolution and with a higher runtime overhead.
420
421See :ref:`InterfaceRtemsClockGetRealtimeCoarseBintime` and
422:ref:`InterfaceRtemsClockGetRealtimeCoarseTimeval` to get the time in
423alternative formats.
424
425.. rubric:: CONSTRAINTS:
426
427The following constraints apply to this directive:
428
429* The directive may be called from within any runtime context.
430
431* The directive will not cause the calling task to be preempted.
432
433* The directive requires a :term:`Clock Driver`.
434
435.. Generated from spec:/rtems/clock/if/get-realtime-coarse-bintime
436
437.. raw:: latex
438
439    \clearpage
440
441.. index:: rtems_clock_get_realtime_coarse_bintime()
442
443.. _InterfaceRtemsClockGetRealtimeCoarseBintime:
444
445rtems_clock_get_realtime_coarse_bintime()
446-----------------------------------------
447
448Gets the time elapsed since the :term:`Unix epoch` measured using
449:term:`CLOCK_REALTIME` in coarse resolution in binary time format.
450
451.. rubric:: CALLING SEQUENCE:
452
453.. code-block:: c
454
455    void rtems_clock_get_realtime_coarse_bintime( struct bintime *time_snapshot );
456
457.. rubric:: PARAMETERS:
458
459``time_snapshot``
460    This parameter is the pointer to a :c:type:`bintime` object.  The time
461    elapsed since the :term:`Unix epoch` measured using the
462    :term:`CLOCK_REALTIME` at some time point close to the directive call will
463    be stored in this object.  Calling the directive with a pointer equal to
464    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
465    behaviour.
466
467.. rubric:: NOTES:
468
469The directive does not access a device to get the time.  It uses a recent
470snapshot provided by the :term:`Clock Driver`.  Alternatively, the
471:ref:`InterfaceRtemsClockGetRealtimeBintime` directive may be used to get the
472time in a higher resolution and with a higher runtime overhead.
473
474See :ref:`InterfaceRtemsClockGetRealtimeCoarse` and
475:ref:`InterfaceRtemsClockGetRealtimeCoarseTimeval` to get the time in
476alternative formats.
477
478.. rubric:: CONSTRAINTS:
479
480The following constraints apply to this directive:
481
482* The directive may be called from within any runtime context.
483
484* The directive will not cause the calling task to be preempted.
485
486* The directive requires a :term:`Clock Driver`.
487
488.. Generated from spec:/rtems/clock/if/get-realtime-coarse-timeval
489
490.. raw:: latex
491
492    \clearpage
493
494.. index:: rtems_clock_get_realtime_coarse_timeval()
495
496.. _InterfaceRtemsClockGetRealtimeCoarseTimeval:
497
498rtems_clock_get_realtime_coarse_timeval()
499-----------------------------------------
500
501Gets the time elapsed since the :term:`Unix epoch` measured using
502:term:`CLOCK_REALTIME` in coarse resolution in seconds and microseconds format.
503
504.. rubric:: CALLING SEQUENCE:
505
506.. code-block:: c
507
508    void rtems_clock_get_realtime_coarse_timeval( struct timeval *time_snapshot );
509
510.. rubric:: PARAMETERS:
511
512``time_snapshot``
513    This parameter is the pointer to a `struct timeval
514    <https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html>`_
515    object.  The time elapsed since the :term:`Unix epoch` measured using the
516    :term:`CLOCK_REALTIME` at some time point close to the directive call will
517    be stored in this object.  Calling the directive with a pointer equal to
518    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
519    behaviour.
520
521.. rubric:: NOTES:
522
523The directive does not access a device to get the time.  It uses a recent
524snapshot provided by the :term:`Clock Driver`.  Alternatively, the
525:ref:`InterfaceRtemsClockGetRealtimeTimeval` directive may be used to get the
526time in a higher resolution and with a higher runtime overhead.
527
528See :ref:`InterfaceRtemsClockGetRealtimeCoarse` and
529:ref:`InterfaceRtemsClockGetRealtimeCoarseTimeval` to get the time in
530alternative formats.
531
532.. rubric:: CONSTRAINTS:
533
534The following constraints apply to this directive:
535
536* The directive may be called from within any runtime context.
537
538* The directive will not cause the calling task to be preempted.
539
540* The directive requires a :term:`Clock Driver`.
541
542.. Generated from spec:/rtems/clock/if/get-monotonic
543
544.. raw:: latex
545
546    \clearpage
547
548.. index:: rtems_clock_get_monotonic()
549
550.. _InterfaceRtemsClockGetMonotonic:
551
552rtems_clock_get_monotonic()
553---------------------------
554
555Gets the time elapsed since some fixed time point in the past measured using
556the :term:`CLOCK_MONOTONIC` in seconds and nanoseconds format.
557
558.. rubric:: CALLING SEQUENCE:
559
560.. code-block:: c
561
562    void rtems_clock_get_monotonic( struct timespec *time_snapshot );
563
564.. rubric:: PARAMETERS:
565
566``time_snapshot``
567    This parameter is the pointer to a :c:type:`bintime` object.  The time
568    elapsed since some fixed time point in the past measured using the
569    :term:`CLOCK_MONOTONIC` at some time point during the directive call will
570    be stored in this object.  Calling the directive with a pointer equal to
571    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
572    behaviour.
573
574.. rubric:: NOTES:
575
576The directive accesses a device provided by the :term:`Clock Driver` to get the
577time in the highest resolution available to the system.  Alternatively, the
578:ref:`InterfaceRtemsClockGetMonotonicCoarse` directive may be used to get the
579time with in a lower resolution and with less runtime overhead.
580
581See :ref:`InterfaceRtemsClockGetMonotonicBintime`,
582:ref:`InterfaceRtemsClockGetMonotonicSbintime`, and
583:ref:`InterfaceRtemsClockGetMonotonicTimeval` to get the time in alternative
584formats.
585
586.. rubric:: CONSTRAINTS:
587
588The following constraints apply to this directive:
589
590* The directive may be called from within any runtime context.
591
592* The directive will not cause the calling task to be preempted.
593
594* The directive requires a :term:`Clock Driver`.
595
596.. Generated from spec:/rtems/clock/if/get-monotonic-bintime
597
598.. raw:: latex
599
600    \clearpage
601
602.. index:: rtems_clock_get_monotonic_bintime()
603
604.. _InterfaceRtemsClockGetMonotonicBintime:
605
606rtems_clock_get_monotonic_bintime()
607-----------------------------------
608
609Gets the time elapsed since some fixed time point in the past measured using
610the :term:`CLOCK_MONOTONIC` in binary time format.
611
612.. rubric:: CALLING SEQUENCE:
613
614.. code-block:: c
615
616    void rtems_clock_get_monotonic_bintime( struct bintime *time_snapshot );
617
618.. rubric:: PARAMETERS:
619
620``time_snapshot``
621    This parameter is the pointer to a :c:type:`bintime` object.  The time
622    elapsed since some fixed time point in the past measured using the
623    :term:`CLOCK_MONOTONIC` at some time point during the directive call will
624    be stored in this object.  Calling the directive with a pointer equal to
625    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
626    behaviour.
627
628.. rubric:: NOTES:
629
630The directive accesses a device provided by the :term:`Clock Driver` to get the
631time in the highest resolution available to the system.  Alternatively, the
632:ref:`InterfaceRtemsClockGetMonotonicCoarseBintime` directive may be used to
633get the time in a lower resolution and with less runtime overhead.
634
635See :ref:`InterfaceRtemsClockGetMonotonic`,
636:ref:`InterfaceRtemsClockGetMonotonicSbintime`, and
637:ref:`InterfaceRtemsClockGetMonotonicTimeval` to get the time in alternative
638formats.
639
640.. rubric:: CONSTRAINTS:
641
642The following constraints apply to this directive:
643
644* The directive may be called from within any runtime context.
645
646* The directive will not cause the calling task to be preempted.
647
648* The directive requires a :term:`Clock Driver`.
649
650.. Generated from spec:/rtems/clock/if/get-monotonic-sbintime
651
652.. raw:: latex
653
654    \clearpage
655
656.. index:: rtems_clock_get_monotonic_sbintime()
657
658.. _InterfaceRtemsClockGetMonotonicSbintime:
659
660rtems_clock_get_monotonic_sbintime()
661------------------------------------
662
663Gets the time elapsed since some fixed time point in the past measured using
664the :term:`CLOCK_MONOTONIC` in signed binary time format.
665
666.. rubric:: CALLING SEQUENCE:
667
668.. code-block:: c
669
670    int64_t rtems_clock_get_monotonic_sbintime( void );
671
672.. rubric:: RETURN VALUES:
673
674Returns the time elapsed since some fixed time point in the past measured using
675the :term:`CLOCK_MONOTONIC` at some time point during the directive call.
676
677.. rubric:: NOTES:
678
679The directive accesses a device provided by the :term:`Clock Driver` to get the
680time in the highest resolution available to the system.
681
682See :ref:`InterfaceRtemsClockGetMonotonic`,
683:ref:`InterfaceRtemsClockGetMonotonicBintime`, and
684:ref:`InterfaceRtemsClockGetMonotonicTimeval` to get the time in alternative
685formats.
686
687.. rubric:: CONSTRAINTS:
688
689The following constraints apply to this directive:
690
691* The directive may be called from within any runtime context.
692
693* The directive will not cause the calling task to be preempted.
694
695* The directive requires a :term:`Clock Driver`.
696
697.. Generated from spec:/rtems/clock/if/get-monotonic-timeval
698
699.. raw:: latex
700
701    \clearpage
702
703.. index:: rtems_clock_get_monotonic_timeval()
704
705.. _InterfaceRtemsClockGetMonotonicTimeval:
706
707rtems_clock_get_monotonic_timeval()
708-----------------------------------
709
710Gets the time elapsed since some fixed time point in the past measured using
711the :term:`CLOCK_MONOTONIC` in seconds and microseconds format.
712
713.. rubric:: CALLING SEQUENCE:
714
715.. code-block:: c
716
717    void rtems_clock_get_monotonic_timeval( struct timeval *time_snapshot );
718
719.. rubric:: PARAMETERS:
720
721``time_snapshot``
722    This parameter is the pointer to a :c:type:`bintime` object.  The time
723    elapsed since some fixed time point in the past measured using the
724    :term:`CLOCK_MONOTONIC` at some time point during the directive call will
725    be stored in this object.  Calling the directive with a pointer equal to
726    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
727    behaviour.
728
729.. rubric:: NOTES:
730
731The directive accesses a device provided by the :term:`Clock Driver` to get the
732time in the highest resolution available to the system.  Alternatively, the
733:ref:`InterfaceRtemsClockGetMonotonicCoarseTimeval` directive may be used to
734get the time in a lower resolution and with less runtime overhead.
735
736See :ref:`InterfaceRtemsClockGetMonotonic`,
737:ref:`InterfaceRtemsClockGetMonotonicBintime`, and
738:ref:`InterfaceRtemsClockGetMonotonicSbintime` to get the time in alternative
739formats.
740
741.. rubric:: CONSTRAINTS:
742
743The following constraints apply to this directive:
744
745* The directive may be called from within any runtime context.
746
747* The directive will not cause the calling task to be preempted.
748
749* The directive requires a :term:`Clock Driver`.
750
751.. Generated from spec:/rtems/clock/if/get-monotonic-coarse
752
753.. raw:: latex
754
755    \clearpage
756
757.. index:: rtems_clock_get_monotonic_coarse()
758
759.. _InterfaceRtemsClockGetMonotonicCoarse:
760
761rtems_clock_get_monotonic_coarse()
762----------------------------------
763
764Gets the time elapsed since some fixed time point in the past measured using
765the :term:`CLOCK_MONOTONIC` in coarse resolution in seconds and nanoseconds
766format.
767
768.. rubric:: CALLING SEQUENCE:
769
770.. code-block:: c
771
772    void rtems_clock_get_monotonic_coarse( struct timespec *time_snapshot );
773
774.. rubric:: PARAMETERS:
775
776``time_snapshot``
777    This parameter is the pointer to a :c:type:`bintime` object.  The time
778    elapsed since some fixed time point in the past measured using the
779    :term:`CLOCK_MONOTONIC` at some time point close to the directive call will
780    be stored in this object.  Calling the directive with a pointer equal to
781    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
782    behaviour.
783
784.. rubric:: NOTES:
785
786The directive does not access a device to get the time.  It uses a recent
787snapshot provided by the :term:`Clock Driver`.  Alternatively, the
788:ref:`InterfaceRtemsClockGetMonotonic` directive may be used to get the time in
789a higher resolution and with a higher runtime overhead.
790
791See :ref:`InterfaceRtemsClockGetMonotonicCoarseBintime` and
792:ref:`InterfaceRtemsClockGetMonotonicCoarseTimeval` to get the time in
793alternative formats.
794
795.. rubric:: CONSTRAINTS:
796
797The following constraints apply to this directive:
798
799* The directive may be called from within any runtime context.
800
801* The directive will not cause the calling task to be preempted.
802
803* The directive requires a :term:`Clock Driver`.
804
805.. Generated from spec:/rtems/clock/if/get-monotonic-coarse-bintime
806
807.. raw:: latex
808
809    \clearpage
810
811.. index:: rtems_clock_get_monotonic_coarse_bintime()
812
813.. _InterfaceRtemsClockGetMonotonicCoarseBintime:
814
815rtems_clock_get_monotonic_coarse_bintime()
816------------------------------------------
817
818Gets the time elapsed since some fixed time point in the past measured using
819the :term:`CLOCK_MONOTONIC` in coarse resolution in binary time format.
820
821.. rubric:: CALLING SEQUENCE:
822
823.. code-block:: c
824
825    void rtems_clock_get_monotonic_coarse_bintime( struct bintime *time_snapshot );
826
827.. rubric:: PARAMETERS:
828
829``time_snapshot``
830    This parameter is the pointer to a :c:type:`bintime` object.  The time
831    elapsed since some fixed time point in the past measured using the
832    :term:`CLOCK_MONOTONIC` at some time point close to the directive call will
833    be stored in this object.  Calling the directive with a pointer equal to
834    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
835    behaviour.
836
837.. rubric:: NOTES:
838
839The directive does not access a device to get the time.  It uses a recent
840snapshot provided by the :term:`Clock Driver`.  Alternatively, the
841:ref:`InterfaceRtemsClockGetMonotonicBintime` directive may be used to get the
842time in a higher resolution and with a higher runtime overhead.
843
844See :ref:`InterfaceRtemsClockGetMonotonicCoarse` and
845:ref:`InterfaceRtemsClockGetMonotonicCoarseTimeval` to get the time in
846alternative formats.
847
848.. rubric:: CONSTRAINTS:
849
850The following constraints apply to this directive:
851
852* The directive may be called from within any runtime context.
853
854* The directive will not cause the calling task to be preempted.
855
856* The directive requires a :term:`Clock Driver`.
857
858.. Generated from spec:/rtems/clock/if/get-monotonic-coarse-timeval
859
860.. raw:: latex
861
862    \clearpage
863
864.. index:: rtems_clock_get_monotonic_coarse_timeval()
865
866.. _InterfaceRtemsClockGetMonotonicCoarseTimeval:
867
868rtems_clock_get_monotonic_coarse_timeval()
869------------------------------------------
870
871Gets the time elapsed since some fixed time point in the past measured using
872the :term:`CLOCK_MONOTONIC` in coarse resolution in seconds and microseconds
873format.
874
875.. rubric:: CALLING SEQUENCE:
876
877.. code-block:: c
878
879    void rtems_clock_get_monotonic_coarse_timeval( struct timeval *time_snapshot );
880
881.. rubric:: PARAMETERS:
882
883``time_snapshot``
884    This parameter is the pointer to a :c:type:`bintime` object.  The time
885    elapsed since some fixed time point in the past measured using the
886    :term:`CLOCK_MONOTONIC` at some time point close to the directive call will
887    be stored in this object.  Calling the directive with a pointer equal to
888    `NULL <https://en.cppreference.com/w/c/types/NULL>`_ is undefined
889    behaviour.
890
891.. rubric:: NOTES:
892
893The directive does not access a device to get the time.  It uses a recent
894snapshot provided by the :term:`Clock Driver`.  Alternatively, the
895:ref:`InterfaceRtemsClockGetMonotonicTimeval` directive may be used to get the
896time in a higher resolution and with a higher runtime overhead.
897
898See :ref:`InterfaceRtemsClockGetMonotonicCoarse` and
899:ref:`InterfaceRtemsClockGetMonotonicCoarseBintime` to get the time in
900alternative formats.
901
902.. rubric:: CONSTRAINTS:
903
904The following constraints apply to this directive:
905
906* The directive may be called from within any runtime context.
907
908* The directive will not cause the calling task to be preempted.
909
910* The directive requires a :term:`Clock Driver`.
911
912.. Generated from spec:/rtems/clock/if/get-boot-time
913
914.. raw:: latex
915
916    \clearpage
917
918.. index:: rtems_clock_get_boot_time()
919
920.. _InterfaceRtemsClockGetBootTime:
921
922rtems_clock_get_boot_time()
923---------------------------
924
925Gets the time elapsed since the :term:`Unix epoch` at some time point during
926system initialization in seconds and nanoseconds format.
927
928.. rubric:: CALLING SEQUENCE:
929
930.. code-block:: c
931
932    void rtems_clock_get_boot_time( struct timespec *boot_time );
933
934.. rubric:: PARAMETERS:
935
936``boot_time``
937    This parameter is the pointer to a `struct timespec
938    <https://en.cppreference.com/w/c/chrono/timespec>`_ object.  The time
939    elapsed since the :term:`Unix epoch` at some time point during system
940    initialization call will be stored in this object.  Calling the directive
941    with a pointer equal to `NULL
942    <https://en.cppreference.com/w/c/types/NULL>`_ is undefined behaviour.
943
944.. rubric:: NOTES:
945
946See :ref:`InterfaceRtemsClockGetBootTimeBintime` and
947:ref:`InterfaceRtemsClockGetBootTimeTimeval` to get the boot time in
948alternative formats.  Setting the :term:`CLOCK_REALTIME` will also set the boot
949time.
950
951.. rubric:: CONSTRAINTS:
952
953The following constraints apply to this directive:
954
955* The directive may be called from within any runtime context.
956
957* The directive will not cause the calling task to be preempted.
958
959* The directive requires a :term:`Clock Driver`.
960
961.. Generated from spec:/rtems/clock/if/get-boot-time-bintime
962
963.. raw:: latex
964
965    \clearpage
966
967.. index:: rtems_clock_get_boot_time_bintime()
968
969.. _InterfaceRtemsClockGetBootTimeBintime:
970
971rtems_clock_get_boot_time_bintime()
972-----------------------------------
973
974Gets the time elapsed since the :term:`Unix epoch` at some time point during
975system initialization in binary time format.
976
977.. rubric:: CALLING SEQUENCE:
978
979.. code-block:: c
980
981    void rtems_clock_get_boot_time_bintime( struct bintime *boot_time );
982
983.. rubric:: PARAMETERS:
984
985``boot_time``
986    This parameter is the pointer to a :c:type:`bintime` object.  The time
987    elapsed since the :term:`Unix epoch` at some time point during system
988    initialization call will be stored in this object.  Calling the directive
989    with a pointer equal to `NULL
990    <https://en.cppreference.com/w/c/types/NULL>`_ is undefined behaviour.
991
992.. rubric:: NOTES:
993
994See :ref:`InterfaceRtemsClockGetBootTime` and
995:ref:`InterfaceRtemsClockGetBootTimeTimeval` to get the boot time in
996alternative formats.  Setting the :term:`CLOCK_REALTIME` will also set the boot
997time.
998
999.. rubric:: CONSTRAINTS:
1000
1001The following constraints apply to this directive:
1002
1003* The directive may be called from within any runtime context.
1004
1005* The directive will not cause the calling task to be preempted.
1006
1007* The directive requires a :term:`Clock Driver`.
1008
1009.. Generated from spec:/rtems/clock/if/get-boot-time-timeval
1010
1011.. raw:: latex
1012
1013    \clearpage
1014
1015.. index:: rtems_clock_get_boot_time_timeval()
1016
1017.. _InterfaceRtemsClockGetBootTimeTimeval:
1018
1019rtems_clock_get_boot_time_timeval()
1020-----------------------------------
1021
1022Gets the time elapsed since the :term:`Unix epoch` at some time point during
1023system initialization in seconds and microseconds format.
1024
1025.. rubric:: CALLING SEQUENCE:
1026
1027.. code-block:: c
1028
1029    void rtems_clock_get_boot_time_timeval( struct timeval *boot_time );
1030
1031.. rubric:: PARAMETERS:
1032
1033``boot_time``
1034    This parameter is the pointer to a `struct timeval
1035    <https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html>`_
1036    object.  The time elapsed since the :term:`Unix epoch` at some time point
1037    during system initialization call will be stored in this object.  Calling
1038    the directive with a pointer equal to `NULL
1039    <https://en.cppreference.com/w/c/types/NULL>`_ is undefined behaviour.
1040
1041.. rubric:: NOTES:
1042
1043See :ref:`InterfaceRtemsClockGetBootTime` and
1044:ref:`InterfaceRtemsClockGetBootTimeBintime` to get the boot time in
1045alternative formats.  Setting the :term:`CLOCK_REALTIME` will also set the boot
1046time.
1047
1048.. rubric:: CONSTRAINTS:
1049
1050The following constraints apply to this directive:
1051
1052* The directive may be called from within any runtime context.
1053
1054* The directive will not cause the calling task to be preempted.
1055
1056* The directive requires a :term:`Clock Driver`.
1057
1058.. Generated from spec:/rtems/clock/if/get-seconds-since-epoch
1059
1060.. raw:: latex
1061
1062    \clearpage
1063
1064.. index:: rtems_clock_get_seconds_since_epoch()
1065
1066.. _InterfaceRtemsClockGetSecondsSinceEpoch:
1067
1068rtems_clock_get_seconds_since_epoch()
1069-------------------------------------
1070
1071Gets the seconds elapsed since the :term:`RTEMS epoch` and the current
1072:term:`CLOCK_REALTIME`.
1073
1074.. rubric:: CALLING SEQUENCE:
1075
1076.. code-block:: c
1077
1078    rtems_status_code rtems_clock_get_seconds_since_epoch(
1079      rtems_interval *seconds_since_rtems_epoch
1080    );
1081
1082.. rubric:: PARAMETERS:
1083
1084``seconds_since_rtems_epoch``
1085    This parameter is the pointer to an :c:type:`rtems_interval` object.  When
1086    the directive call is successful, the seconds elapsed since the
1087    :term:`RTEMS epoch` and the :term:`CLOCK_REALTIME` at some point during the
1088    directive call will be stored in this object.
1089
1090.. rubric:: RETURN VALUES:
1091
1092:c:macro:`RTEMS_SUCCESSFUL`
1093    The requested operation was successful.
1094
1095:c:macro:`RTEMS_INVALID_ADDRESS`
1096    The ``seconds_since_rtems_epoch`` parameter was `NULL
1097    <https://en.cppreference.com/w/c/types/NULL>`_.
1098
1099:c:macro:`RTEMS_NOT_DEFINED`
1100    The :term:`CLOCK_REALTIME` was not set.  It can be set with
1101    :ref:`InterfaceRtemsClockSet`.
1102
1103.. rubric:: CONSTRAINTS:
1104
1105The following constraints apply to this directive:
1106
1107* The directive may be called from within any runtime context.
1108
1109* The directive will not cause the calling task to be preempted.
1110
1111* The directive requires a :term:`Clock Driver`.
1112
1113.. Generated from spec:/rtems/clock/if/get-ticks-per-second
1114
1115.. raw:: latex
1116
1117    \clearpage
1118
1119.. index:: rtems_clock_get_ticks_per_second()
1120
1121.. _InterfaceRtemsClockGetTicksPerSecond:
1122
1123rtems_clock_get_ticks_per_second()
1124----------------------------------
1125
1126Gets the number of :term:`clock ticks <clock tick>` per second configured for
1127the application.
1128
1129.. rubric:: CALLING SEQUENCE:
1130
1131.. code-block:: c
1132
1133    rtems_interval rtems_clock_get_ticks_per_second( void );
1134
1135.. rubric:: RETURN VALUES:
1136
1137Returns the number of clock ticks per second configured for this application.
1138
1139.. rubric:: NOTES:
1140
1141The number of clock ticks per second is defined indirectly by the
1142:ref:`CONFIGURE_MICROSECONDS_PER_TICK` configuration option.
1143
1144.. rubric:: CONSTRAINTS:
1145
1146The following constraints apply to this directive:
1147
1148* The directive may be called from within any runtime context.
1149
1150* The directive will not cause the calling task to be preempted.
1151
1152.. Generated from spec:/rtems/clock/if/get-ticks-since-boot
1153
1154.. raw:: latex
1155
1156    \clearpage
1157
1158.. index:: rtems_clock_get_ticks_since_boot()
1159
1160.. _InterfaceRtemsClockGetTicksSinceBoot:
1161
1162rtems_clock_get_ticks_since_boot()
1163----------------------------------
1164
1165Gets the number of :term:`clock ticks <clock tick>` since some time point
1166during the system initialization or the last overflow of the clock tick
1167counter.
1168
1169.. rubric:: CALLING SEQUENCE:
1170
1171.. code-block:: c
1172
1173    rtems_interval rtems_clock_get_ticks_since_boot( void );
1174
1175.. rubric:: RETURN VALUES:
1176
1177Returns the number of :term:`clock ticks <clock tick>` since some time point
1178during the system initialization or the last overflow of the clock tick
1179counter.
1180
1181.. rubric:: NOTES:
1182
1183With a 1ms clock tick, this counter overflows after 50 days since boot.  This
1184is the historical measure of uptime in an RTEMS system.  The newer service
1185:ref:`InterfaceRtemsClockGetUptime` is another and potentially more accurate
1186way of obtaining similar information.
1187
1188.. rubric:: CONSTRAINTS:
1189
1190The following constraints apply to this directive:
1191
1192* The directive may be called from within any runtime context.
1193
1194* The directive will not cause the calling task to be preempted.
1195
1196.. Generated from spec:/rtems/clock/if/get-uptime
1197
1198.. raw:: latex
1199
1200    \clearpage
1201
1202.. index:: rtems_clock_get_uptime()
1203
1204.. _InterfaceRtemsClockGetUptime:
1205
1206rtems_clock_get_uptime()
1207------------------------
1208
1209Gets the seconds and nanoseconds elapsed since some time point during the
1210system initialization using :term:`CLOCK_MONOTONIC`.
1211
1212.. rubric:: CALLING SEQUENCE:
1213
1214.. code-block:: c
1215
1216    rtems_status_code rtems_clock_get_uptime( struct timespec *uptime );
1217
1218.. rubric:: PARAMETERS:
1219
1220``uptime``
1221    This parameter is the pointer to a `struct timeval
1222    <https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html>`_
1223    object.  When the directive call is successful, the seconds and nanoseconds
1224    elapsed since some time point during the system initialization and some
1225    point during the directive call using :term:`CLOCK_MONOTONIC` will be
1226    stored in this object.
1227
1228.. rubric:: RETURN VALUES:
1229
1230:c:macro:`RTEMS_SUCCESSFUL`
1231    The requested operation was successful.
1232
1233:c:macro:`RTEMS_INVALID_ADDRESS`
1234    The ``uptime`` parameter was `NULL
1235    <https://en.cppreference.com/w/c/types/NULL>`_.
1236
1237.. rubric:: CONSTRAINTS:
1238
1239The following constraints apply to this directive:
1240
1241* The directive may be called from within any runtime context.
1242
1243* The directive will not cause the calling task to be preempted.
1244
1245* The directive requires a :term:`Clock Driver`.
1246
1247.. Generated from spec:/rtems/clock/if/get-uptime-timeval
1248
1249.. raw:: latex
1250
1251    \clearpage
1252
1253.. index:: rtems_clock_get_uptime_timeval()
1254
1255.. _InterfaceRtemsClockGetUptimeTimeval:
1256
1257rtems_clock_get_uptime_timeval()
1258--------------------------------
1259
1260Gets the seconds and microseconds elapsed since some time point during the
1261system initialization using :term:`CLOCK_MONOTONIC`.
1262
1263.. rubric:: CALLING SEQUENCE:
1264
1265.. code-block:: c
1266
1267    void rtems_clock_get_uptime_timeval( struct timeval *uptime );
1268
1269.. rubric:: PARAMETERS:
1270
1271``uptime``
1272    This parameter is the pointer to a `struct timeval
1273    <https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html>`_
1274    object.  The seconds and microseconds elapsed since some time point during
1275    the system initialization and some point during the directive call using
1276    :term:`CLOCK_MONOTONIC` will be stored in this object.  The pointer shall
1277    be valid, otherwise the behaviour is undefined.
1278
1279.. rubric:: CONSTRAINTS:
1280
1281The following constraints apply to this directive:
1282
1283* The directive may be called from within any runtime context.
1284
1285* The directive will not cause the calling task to be preempted.
1286
1287* The directive requires a :term:`Clock Driver`.
1288
1289.. Generated from spec:/rtems/clock/if/get-uptime-seconds
1290
1291.. raw:: latex
1292
1293    \clearpage
1294
1295.. index:: rtems_clock_get_uptime_seconds()
1296
1297.. _InterfaceRtemsClockGetUptimeSeconds:
1298
1299rtems_clock_get_uptime_seconds()
1300--------------------------------
1301
1302Gets the seconds elapsed since some time point during the system initialization
1303using :term:`CLOCK_MONOTONIC`.
1304
1305.. rubric:: CALLING SEQUENCE:
1306
1307.. code-block:: c
1308
1309    time_t rtems_clock_get_uptime_seconds( void );
1310
1311.. rubric:: RETURN VALUES:
1312
1313Returns the seconds elapsed since some time point during the system
1314initialization and some point during the directive call using
1315:term:`CLOCK_MONOTONIC`.
1316
1317.. rubric:: CONSTRAINTS:
1318
1319The following constraints apply to this directive:
1320
1321* The directive may be called from within any runtime context.
1322
1323* The directive will not cause the calling task to be preempted.
1324
1325* The directive requires a :term:`Clock Driver`.
1326
1327.. Generated from spec:/rtems/clock/if/get-uptime-nanoseconds
1328
1329.. raw:: latex
1330
1331    \clearpage
1332
1333.. index:: rtems_clock_get_uptime_nanoseconds()
1334
1335.. _InterfaceRtemsClockGetUptimeNanoseconds:
1336
1337rtems_clock_get_uptime_nanoseconds()
1338------------------------------------
1339
1340Gets the nanoseconds elapsed since some time point during the system
1341initialization using :term:`CLOCK_MONOTONIC`.
1342
1343.. rubric:: CALLING SEQUENCE:
1344
1345.. code-block:: c
1346
1347    uint64_t rtems_clock_get_uptime_nanoseconds( void );
1348
1349.. rubric:: RETURN VALUES:
1350
1351Returns the nanoseconds elapsed since some time point during the system
1352initialization and some point during the directive call using
1353:term:`CLOCK_MONOTONIC`.
1354
1355.. rubric:: CONSTRAINTS:
1356
1357The following constraints apply to this directive:
1358
1359* The directive may be called from within any runtime context.
1360
1361* The directive will not cause the calling task to be preempted.
1362
1363* The directive requires a :term:`Clock Driver`.
1364
1365.. Generated from spec:/rtems/clock/if/tick-later
1366
1367.. raw:: latex
1368
1369    \clearpage
1370
1371.. index:: rtems_clock_tick_later()
1372
1373.. _InterfaceRtemsClockTickLater:
1374
1375rtems_clock_tick_later()
1376------------------------
1377
1378Gets a :term:`clock tick` value which is at least delta clock ticks in the
1379future.
1380
1381.. rubric:: CALLING SEQUENCE:
1382
1383.. code-block:: c
1384
1385    rtems_interval rtems_clock_tick_later( rtems_interval delta );
1386
1387.. rubric:: PARAMETERS:
1388
1389``delta``
1390    This parameter is the delta value in clock ticks.
1391
1392.. rubric:: RETURN VALUES:
1393
1394Returns a :term:`clock tick` counter value which is at least ``delta`` clock
1395ticks in the future.
1396
1397.. rubric:: CONSTRAINTS:
1398
1399The following constraints apply to this directive:
1400
1401* The directive may be called from within any runtime context.
1402
1403* The directive will not cause the calling task to be preempted.
1404
1405* The directive requires a :term:`Clock Driver`.
1406
1407.. Generated from spec:/rtems/clock/if/tick-later-usec
1408
1409.. raw:: latex
1410
1411    \clearpage
1412
1413.. index:: rtems_clock_tick_later_usec()
1414
1415.. _InterfaceRtemsClockTickLaterUsec:
1416
1417rtems_clock_tick_later_usec()
1418-----------------------------
1419
1420Gets a :term:`clock tick` value which is at least delta microseconds in the
1421future.
1422
1423.. rubric:: CALLING SEQUENCE:
1424
1425.. code-block:: c
1426
1427    rtems_interval rtems_clock_tick_later_usec( rtems_interval delta_in_usec );
1428
1429.. rubric:: PARAMETERS:
1430
1431``delta_in_usec``
1432    This parameter is the delta value in microseconds.
1433
1434.. rubric:: RETURN VALUES:
1435
1436Returns a :term:`clock tick` counter value which is at least ``delta_in_usec``
1437microseconds in the future.
1438
1439.. rubric:: CONSTRAINTS:
1440
1441The following constraints apply to this directive:
1442
1443* The directive may be called from within any runtime context.
1444
1445* The directive will not cause the calling task to be preempted.
1446
1447* The directive requires a :term:`Clock Driver`.
1448
1449.. Generated from spec:/rtems/clock/if/tick-before
1450
1451.. raw:: latex
1452
1453    \clearpage
1454
1455.. index:: rtems_clock_tick_before()
1456
1457.. _InterfaceRtemsClockTickBefore:
1458
1459rtems_clock_tick_before()
1460-------------------------
1461
1462Indicates if the current :term:`clock tick` counter is before the ticks.
1463
1464.. rubric:: CALLING SEQUENCE:
1465
1466.. code-block:: c
1467
1468    bool rtems_clock_tick_before( rtems_interval ticks );
1469
1470.. rubric:: PARAMETERS:
1471
1472``ticks``
1473    This parameter is the ticks value to check.
1474
1475.. rubric:: RETURN VALUES:
1476
1477Returns true, if current :term:`clock tick` counter indicates a time before the
1478time in ticks, otherwise returns false.
1479
1480.. rubric:: NOTES:
1481
1482This directive can be used to write busy loops with a timeout.
1483
1484.. code-block:: c
1485    :linenos:
1486
1487    status busy( void )
1488    {
1489      rtems_interval timeout;
1490
1491      timeout = rtems_clock_tick_later_usec( 10000 );
1492
1493      do {
1494        if ( ok() ) {
1495          return success;
1496        }
1497      } while ( rtems_clock_tick_before( timeout ) );
1498
1499      return timeout;
1500    }
1501
1502.. rubric:: CONSTRAINTS:
1503
1504The following constraints apply to this directive:
1505
1506* The directive may be called from within any runtime context.
1507
1508* The directive will not cause the calling task to be preempted.
1509
1510* The directive requires a :term:`Clock Driver`.
Note: See TracBrowser for help on using the repository browser.