procedure Clock_Get ( Option : in RTEMS.Clock_Get_Options; Time_Buffer : in RTEMS.Address; Result : out RTEMS.Status_Codes );
RTEMS.SUCCESSFUL
- current time obtained successfully
RTEMS.NOT_DEFINED
- system date and time is not set
RTEMS.INVALID_ADDRESS
- time_buffer
is NULL
This directive obtains the system date and time. If
the caller is attempting to obtain the date and time (i.e.
option is set to either RTEMS.CLOCK_GET_SECONDS_SINCE_EPOCH
,
RTEMS.CLOCK_GET_TOD
, or
RTEMS.CLOCK_GET_TIME_VALUE
) and the date and time
has not been set with a previous call to
rtems.clock_set
, then the
RTEMS.NOT_DEFINED
status code is returned.
The caller can always obtain the number of ticks per second (option is
RTEMS.CLOCK_GET_TICKS_PER_SECOND
) and the number of
ticks since the executive was initialized option is
RTEMS.CLOCK_GET_TICKS_SINCE_BOOT
).
The option
argument may taken on any value of the enumerated
type rtems_clock_get_options
. The data type expected for
time_buffer
is based on the value of option
as
indicated below:
RTEMS.CLOCK_GET_TOD
- Address of an variable of
type RTEMS.Time_Of_Day
RTEMS.CLOCK_GET_TIME_VALUE
- Address of an variable of
type RTEMS.Clock_Time_Value
RTEMS.CLOCK_GET_TICKS_SINCE_BOOT
- Address of an
variable of type RTEMS.Interval
RTEMS.CLOCK_GET_SECONDS_SINCE_EPOCH
- Address of an
variable of type RTEMS.Interval
RTEMS.CLOCK_GET_TICKS_PER_SECOND
- Address of an
variable of type RTEMS.Interval
This directive is callable from an ISR.
This directive will not cause the running task to be
preempted. Re-initializing RTEMS causes the system date and
time to be reset to an uninitialized state. Another call to
rtems.clock_set
is required to re-initialize the
system date and time to application specific specifications.
Copyright © 1988-2004 OAR Corporation