Collaboration diagram for Time API:

Functions

RDM_RETCODE rdm_timeFromString (const RDM_TCHAR_T *str, RDM_PACKED_TIME_T *ptm)
Convert a string to local time. More...
uint16_t rdm_timeHour (RDM_PACKED_TIME_T tm)
Get the hour of the day. More...
uint16_t rdm_timeMinute (RDM_PACKED_TIME_T tm)
Get the minute of the hour. More...
uint16_t rdm_timeSecond (RDM_PACKED_TIME_T tm)
Get the second of the minute. More...
uint16_t rdm_timeFraction (RDM_PACKED_TIME_T tm)
Get the fractions of the second. More...
RDM_RETCODE rdm_timeToString (RDM_PACKED_TIME_T timeVal, RDM_TIME_FORMAT time_fmt, RDM_TCHAR_T *buf, size_t bufSize, size_t *puSize)
Convert a time to a string. More...
RDM_PACKED_TIME_T rdm_timeZero (void)
Get the local time at the start of a day. More...
RDM_RETCODE rdm_timeNow (int16_t time_zone, RDM_PACKED_TIME_T *ptm)
Get the current local time. More...
RDM_RETCODE rdm_timeNowAsString (int16_t time_zone, RDM_TCHAR_T *timebuf, size_t buflen)
Get current local time as a string. More...
RDM_RETCODE rdm_timetzNowAsString (int16_t time_zone, RDM_TCHAR_T *timebuf, size_t buflen)
Get current time with timezone as a string. More...
RDM_RETCODE rdm_timetzFromString (const RDM_TCHAR_T *str, RDM_PACKED_TIMETZ_T *ptz)
Convert a string to a time. More...
RDM_RETCODE rdm_timetzNow (int16_t time_zone, RDM_PACKED_TIMETZ_T *ptz)
Get the current time with timezone. More...
RDM_RETCODE rdm_timetzToTime (RDM_PACKED_TIMETZ_T timetzVal, int16_t tz_disp, RDM_PACKED_TIME_T *pTimeVal)
Convert a time with timezone to local time. More...
RDM_RETCODE rdm_timetzToString (RDM_PACKED_TIMETZ_T timetzVal, RDM_TIME_FORMAT time_fmt, RDM_TCHAR_T *buf, size_t bufSize, size_t *puSize)
Convert a time with timezone to a string. More...
RDM_PACKED_TIMETZ_T rdm_timetzZero (void)
Get the time at the start of a day. More...

Detailed Description

The RDM time datatype API. The functions here are located in RDM Base Functionality. Linker option:

    -lrdmbase

Function Documentation

rdm_timeFraction()

uint16_t rdm_timeFraction ( RDM_PACKED_TIME_T tm )

#include <rdmtimeapi.h>

Get the fractions of the second.

Get the fractions of the second in 1/10,000th of a second from a packed local time

The fractions of the second (0 - 9999)

Parameters
[in] tm [in] RDM packed local time value

rdm_timeFromString()

RDM_RETCODE rdm_timeFromString ( const RDM_TCHAR_T * str,
RDM_PACKED_TIME_T * ptm
)

#include <rdmtimeapi.h>

Convert a string to local time.

Convert a string to a packed local time.

Return values
sOKAY Normal, successful return.
eINVLITERAL Invalid literal constant specification.
eRANGE Numeric value out of range.
Parameters
[in] str [in] The string to be converted
[out] ptm [out] The packed local time value. The buffer need to be allocated by the caller.

rdm_timeHour()

uint16_t rdm_timeHour ( RDM_PACKED_TIME_T tm )

#include <rdmtimeapi.h>

Get the hour of the day.

Get the hour from a packed local time.

Returns
The hour of the day
Parameters
[in] tm [in] RDM packed local time value

rdm_timeMinute()

uint16_t rdm_timeMinute ( RDM_PACKED_TIME_T tm )

#include <rdmtimeapi.h>

Get the minute of the hour.

Get the minute of the hour from a packed local time.

Returns
The minute of the hour
Parameters
[in] tm [in] RDM packed local time value

rdm_timeNow()

RDM_RETCODE rdm_timeNow ( int16_t time_zone,
RDM_PACKED_TIME_T * ptm
)

#include <rdmtimeapi.h>

Get the current local time.

Get the current local time for the timezone passed in.

Return values
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
Parameters
[in] time_zone [in] timezone value (in min)
[out] ptm [out] current time adjusted with time_zone. The buffer need to be allocated by the caller.

rdm_timeNowAsString()

RDM_RETCODE rdm_timeNowAsString ( int16_t time_zone,
RDM_TCHAR_T * timebuf,
size_t buflen
)

#include <rdmtimeapi.h>

Get current local time as a string.

Get the current local time in string format.

Return values
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
sTRUNCATE Result is truncated.
Parameters
[in] time_zone [in] timezone value (in min)
[out] timebuf [out] NOW value as string
[in] buflen [in] Size of timebuf in number of ASCII characters it can hold

rdm_timeSecond()

uint16_t rdm_timeSecond ( RDM_PACKED_TIME_T tm )

#include <rdmtimeapi.h>

Get the second of the minute.

Get the second of the minute from a packed local time.

Returns
The second of the minute
Parameters
[in] tm [in] RDM packed local time value

rdm_timeToString()

RDM_RETCODE rdm_timeToString ( RDM_PACKED_TIME_T timeVal,
RDM_TIME_FORMAT time_fmt,
RDM_TCHAR_T * buf,
size_t bufSize,
size_t * puSize
)

#include <rdmtimeapi.h>

Convert a time to a string.

Convert a packed local time to a string.

Return values
sOKAY Normal, successful return.
eINVLITERAL Invalid literal constant specification.
sTRUNCATE Result is truncated.
Parameters
[in] timeVal [in] RDM time value
[in] time_fmt [in] RDM time format
[out] buf [out] result time string
[in] bufSize [in] buffer size in number of ASCII characters it can hold
[out] puSize [out] resulting size in number of characters

rdm_timetzFromString()

RDM_RETCODE rdm_timetzFromString ( const RDM_TCHAR_T * str,
RDM_PACKED_TIMETZ_T * ptz
)

#include <rdmtimetzapi.h>

Convert a string to a time.

Convert a string to a packed time with timezone.

Return values
sOKAY Normal, successful return.
eINVLITERAL Invalid literal constant specification.
eRANGE Numeric value out of range.
Parameters
[in] str [in] The string to be converted
[out] ptz [out] The packed time with timezone. The buffer need to be allocated by the caller.

rdm_timetzNow()

RDM_RETCODE rdm_timetzNow ( int16_t time_zone,
RDM_PACKED_TIMETZ_T * ptz
)

#include <rdmtimetzapi.h>

Get the current time with timezone.

Get the current time with timezone.

Return values
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
Parameters
[in] time_zone [in] Timezone value
[out] ptz [out] The current time with timezone

rdm_timetzNowAsString()

RDM_RETCODE rdm_timetzNowAsString ( int16_t time_zone,
RDM_TCHAR_T * timebuf,
size_t buflen
)

#include <rdmtimetzapi.h>

Get current time with timezone as a string.

Get the current time with timezone as a string.

Return values
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
sTRUNCATE Result is truncated.
See also
rdm_timetzNow
Parameters
[in] time_zone [in] Timezone value (in min)
[out] timebuf [out] The current time with timezone
[in] buflen [in] Size of timebuf in number of ASCII characters it can hold

rdm_timetzToString()

RDM_RETCODE rdm_timetzToString ( RDM_PACKED_TIMETZ_T timetzVal,
RDM_TIME_FORMAT time_fmt,
RDM_TCHAR_T * buf,
size_t bufSize,
size_t * puSize
)

#include <rdmtimetzapi.h>

Convert a time with timezone to a string.

Convert a packed time with timezone to a string.

Return values
sOKAY Normal, successful return.
eINVLITERAL Invalid literal constant specification.
sTRUNCATE Result is truncated.
Parameters
[in] timetzVal [in] time with timezone value
[in] time_fmt [in] RDM time format
[out] buf [out] result time string
[in] bufSize [in] buffer size in number of ASCII characters it can hold
[out] puSize [out] resulting size in number of characters

rdm_timetzToTime()

RDM_RETCODE rdm_timetzToTime ( RDM_PACKED_TIMETZ_T timetzVal,
int16_t tz_disp,
RDM_PACKED_TIME_T * pTimeVal
)

#include <rdmtimetzapi.h>

Convert a time with timezone to local time.

Convert a packed time with timezone to packed local time.

Return values
sOKAY Normal, successful return.
Parameters
[in] timetzVal [in] time with timezone value
[in] tz_disp [in] The local timezone
[out] pTimeVal [out] resulting local time value

rdm_timetzZero()

RDM_PACKED_TIMETZ_T rdm_timetzZero ( void )

#include <rdmtimetzapi.h>

Get the time at the start of a day.

Get the packed time at the start of the day (midnight).

Returns
The time at the start of the day

rdm_timeZero()

RDM_PACKED_TIME_T rdm_timeZero ( void )

#include <rdmtimeapi.h>

Get the local time at the start of a day.

Get the packed local time at the start of the day (midnight).

Returns
The local time at the start of the day