Collaboration diagram for Timestamp API:

Functions

const char * rdm_timestampDayAbr (RDM_PACKED_TIMESTAMP_T ts)
Get the day abbreviation. More...
const char * rdm_timestampDayName (RDM_PACKED_TIMESTAMP_T ts)
Get the day name. More...
uint16_t rdm_timestampDayOfMonth (RDM_PACKED_TIMESTAMP_T ts)
Get the day of the month. More...
uint16_t rdm_timestampDayOfWeek (RDM_PACKED_TIMESTAMP_T ts)
Get the day of the week. More...
uint16_t rdm_timestampDayOfYear (RDM_PACKED_TIMESTAMP_T ts)
Get the day of the year. More...
void rdm_timestampDaysDiff (RDM_PACKED_TIMESTAMP_T start, RDM_PACKED_TIMESTAMP_T end, uint32_t *diff)
Get the difference between two timestamps. More...
RDM_RETCODE rdm_timestampFromString (const char *str, RDM_DATE_FORMAT date_fmt, RDM_PACKED_TIMESTAMP_T *ptv)
Convert from a string to a timestamp. More...
uint16_t rdm_timestampHour (RDM_PACKED_TIMESTAMP_T ts)
Get the hour of the day. More...
uint16_t rdm_timestampMinute (RDM_PACKED_TIMESTAMP_T ts)
Get the minute of the hour. More...
uint16_t rdm_timestampSecond (RDM_PACKED_TIMESTAMP_T ts)
Get the second of the minute. More...
uint16_t rdm_timestampFraction (RDM_PACKED_TIMESTAMP_T ts)
Get the fractions of the second. More...
uint16_t rdm_timestampMonth (RDM_PACKED_TIMESTAMP_T ts)
Get the day of the month. More...
const char * rdm_timestampMonthAbr (RDM_PACKED_TIMESTAMP_T ts)
Get the month abbreviation. More...
const char * rdm_timestampMonthName (RDM_PACKED_TIMESTAMP_T ts)
Get the month name. More...
RDM_RETCODE rdm_timestampNow (int16_t time_zone, RDM_PACKED_TIMESTAMP_T *ts)
Get the current local timestamp. More...
RDM_RETCODE rdm_timestampNowAsString (int16_t time_zone, char *tsbuf, size_t buflen)
Get the current local timestamp as string. More...
double rdm_timestampNowAsDouble (void)
Get the current timestamp as a double. More...
uint16_t rdm_timestampQuarter (RDM_PACKED_TIMESTAMP_T ts)
Get the quarter of the year. More...
RDM_RETCODE rdm_timestampToString (RDM_PACKED_TIMESTAMP_T tmsv, RDM_DATE_FORMAT date_fmt, char date_sep, RDM_TIME_FORMAT time_fmt, char *buf, size_t bufSize, size_t *puSize)
Convert a timestamp to a string. More...
uint16_t rdm_timestampWeek (RDM_PACKED_TIMESTAMP_T ts)
Get the week of the year. More...
int32_t rdm_timestampYear (RDM_PACKED_TIMESTAMP_T ts)
Get the year. More...
RDM_PACKED_TIMESTAMP_T rdm_timestampZero (void)
Get the timestamp of the epoch. More...
RDM_RETCODE rdm_timestamptzFromTimestamp (RDM_PACKED_TIMESTAMP_T tsVal, int16_t tz, RDM_PACKED_TIMESTAMPTZ_T *pTszVal)
Convert a local timestamp to timestamp with timezone. More...
RDM_RETCODE rdm_timestamptzFromString (const char *str, RDM_DATE_FORMAT date_fmt, RDM_PACKED_TIMESTAMPTZ_T *ptsz)
Convert from a string to a timestamp with timezone. More...
RDM_RETCODE rdm_timestamptzNow (int16_t time_zone, RDM_PACKED_TIMESTAMPTZ_T *tsz)
Get the current timestamp with timezone. More...
RDM_RETCODE rdm_timestamptzNowAsString (int16_t time_zone, char *tszbuf, size_t buflen)
Get the current timestamp with timezone as string. More...
RDM_RETCODE rdm_timestamptzToTimestamp (RDM_PACKED_TIMESTAMPTZ_T tstzVal, int16_t tz_disp, RDM_PACKED_TIMESTAMP_T *pTsVal)
Convert a timestamp with timezone to a string. More...
RDM_RETCODE rdm_timestamptzToString (RDM_PACKED_TIMESTAMPTZ_T tszVal, RDM_DATE_FORMAT date_format, char date_sep, RDM_TIME_FORMAT time_format, char *buf, size_t bufSize, size_t *puSize)
Convert a timestamp with timezone to a string. More...
RDM_PACKED_TIMESTAMPTZ_T rdm_timestamptzZero (void)
Get the timestamp of the epoch. More...

Detailed Description

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

    -lrdmbase

Function Documentation

rdm_timestampDayAbr()

const char* rdm_timestampDayAbr ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the day abbreviation.

Get the three letter day abbreviation in English from a packed local timestamp.

Returns
The day abbreviation
Parameters
[in] ts RDM timestamp value

rdm_timestampDayName()

const char* rdm_timestampDayName ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the day name.

Get the day name in English from a packed local timestamp.

Returns
The day name
Parameters
[in] ts RDM timestamp value

rdm_timestampDayOfMonth()

uint16_t rdm_timestampDayOfMonth ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the day of the month.

Get the day of month from a packed local timestamp.

Returns
The day of month (1 - 31)
Parameters
[in] ts RDM timestamp value

rdm_timestampDayOfWeek()

uint16_t rdm_timestampDayOfWeek ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the day of the week.

Get the day of week from a packed local timestamp for a US locale where Sunday is the first day of the week.

Returns
The day of week (1 - 7)
Parameters
[in] ts RDM timestamp value

rdm_timestampDayOfYear()

uint16_t rdm_timestampDayOfYear ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the day of the year.

Get the day of year from a packed local timestamp where January 1st is the first day.

Returns
The day of the year (1 - 366)
Parameters
[in] ts RDM timestamp value

rdm_timestampDaysDiff()

void rdm_timestampDaysDiff ( RDM_PACKED_TIMESTAMP_T start,
RDM_PACKED_TIMESTAMP_T end,
uint32_t * diff
)

#include <rdmtimestampapi.h>

Get the difference between two timestamps.

Get the difference between two timestamps measured in the number of whole days.

Parameters
[in] start start timestamp
[in] end end timestamp
[out] diff The difference in whole number of days

rdm_timestampFraction()

uint16_t rdm_timestampFraction ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.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] ts RDM timestamp value

rdm_timestampFromString()

RDM_RETCODE rdm_timestampFromString ( const char * str,
RDM_DATE_FORMAT date_fmt,
RDM_PACKED_TIMESTAMP_T * ptv
)

#include <rdmtimestampapi.h>

Convert from a string to a timestamp.

Convert a string to a packed local timestamp.

Return values
sOKAY Normal, successful return.
eBASE_INVDATE Invalid date value.
eINVDATEFMT Invalid date format.
Parameters
[in] str timestamp value in string
[in] date_fmt RDM date format
[out] ptv The packed local timestamp

rdm_timestampHour()

uint16_t rdm_timestampHour ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the hour of the day.

Get the hour from a packed local timestamp.

Returns
The hour of the day
Parameters
[in] ts RDM timestamp value

rdm_timestampMinute()

uint16_t rdm_timestampMinute ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the minute of the hour.

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

Returns
The minute of the hour
Parameters
[in] ts RDM timestamp value

rdm_timestampMonth()

uint16_t rdm_timestampMonth ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the day of the month.

Get the day of month from a packed local timestamp.

Returns
The day of month (1 - 31)
Parameters
[in] ts RDM timestamp value

rdm_timestampMonthAbr()

const char* rdm_timestampMonthAbr ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the month abbreviation.

Get the three letter month abbreviation in English

Returns
The month abbreviation
Parameters
[in] ts RDM timestamp value

rdm_timestampMonthName()

const char* rdm_timestampMonthName ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the month name.

Get the month name in English from a packed local timestamp.

Returns
The month name
Parameters
[in] ts RDM timestamp value

rdm_timestampNow()

RDM_RETCODE rdm_timestampNow ( int16_t time_zone,
RDM_PACKED_TIMESTAMP_T * ts
)

#include <rdmtimestampapi.h>

Get the current local timestamp.

Get the current local timestamp for a timezone.

Return values
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
See also
rdm_timestampNowAsString
Parameters
[in] time_zone Timezone value (in min)
[out] ts local timestamp value
Examples
core30Example_main.c.

rdm_timestampNowAsDouble()

double rdm_timestampNowAsDouble ( void )

#include <rdmtimestampapi.h>

Get the current timestamp as a double.

Get the current timestamp as a double.

Returns
The current timestamp

rdm_timestampNowAsString()

RDM_RETCODE rdm_timestampNowAsString ( int16_t time_zone,
char * tsbuf,
size_t buflen
)

#include <rdmtimestampapi.h>

Get the current local timestamp as string.

Get the current local timestamp as a string.

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

rdm_timestampQuarter()

uint16_t rdm_timestampQuarter ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the quarter of the year.

Get the quarter of the year from a packed local timestamp.

Returns
The quarter of the year (1 - 4)
Parameters
[in] ts RDM timestamp value

rdm_timestampSecond()

uint16_t rdm_timestampSecond ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the second of the minute.

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

Returns
The second of the minute
Parameters
[in] ts RDM timestamp value

rdm_timestampToString()

RDM_RETCODE rdm_timestampToString ( RDM_PACKED_TIMESTAMP_T tmsv,
RDM_DATE_FORMAT date_fmt,
char date_sep,
RDM_TIME_FORMAT time_fmt,
char * buf,
size_t bufSize,
size_t * puSize
)

#include <rdmtimestampapi.h>

Convert a timestamp to a string.

Convert a packed local timestamp to a string.

Return values
sOKAY Normal, successful return.
eBASE_INVDATE Invalid date value.
eINVDATESEP Invalid date separator.
sTRUNCATE Result is truncated.
Parameters
[in] tmsv RDM timestamp value
[in] date_fmt RDM date format
[in] date_sep date separator
[in] time_fmt RDM time format
[out] buf result timestamp string
[in] bufSize buffer size in number of ASCII characters it can hold
[out] puSize resulting size in number of characters

rdm_timestamptzFromString()

RDM_RETCODE rdm_timestamptzFromString ( const char * str,
RDM_DATE_FORMAT date_fmt,
RDM_PACKED_TIMESTAMPTZ_T * ptsz
)

#include <rdmtimestamptzapi.h>

Convert from a string to a timestamp with timezone.

Convert a string to a packed timestamp with timezone.

Return values
sOKAY Normal, successful return.
eBASE_INVDATE Invalid date value.
eINVDATEFMT Invalid date format.
Parameters
[in] str timestamp value in string
[in] date_fmt RDM date format
[out] ptsz result timestamp value

rdm_timestamptzFromTimestamp()

RDM_RETCODE rdm_timestamptzFromTimestamp ( RDM_PACKED_TIMESTAMP_T tsVal,
int16_t tz,
RDM_PACKED_TIMESTAMPTZ_T * pTszVal
)

#include <rdmtimestamptzapi.h>

Convert a local timestamp to timestamp with timezone.

Convert a local timestamp to timestamp with timezone.

Return values
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
Parameters
[in] tsVal local timestamp value
[in] tz timezone offset (in minutes)
[out] pTszVal resulting timestamp with timezone value

rdm_timestamptzNow()

RDM_RETCODE rdm_timestamptzNow ( int16_t time_zone,
RDM_PACKED_TIMESTAMPTZ_T * tsz
)

#include <rdmtimestamptzapi.h>

Get the current timestamp with timezone.

Get the current timestamp with timezone.

Return values
sOKAY Normal, successful return.
eBASE_INVTIMEZONE Invalid time zone value.
See also
rdm_timestampNowAsString
Parameters
[in] time_zone Timezone value (in min)
[out] tsz current timestamp with timezone

rdm_timestamptzNowAsString()

RDM_RETCODE rdm_timestamptzNowAsString ( int16_t time_zone,
char * tszbuf,
size_t buflen
)

#include <rdmtimestamptzapi.h>

Get the current timestamp with timezone as string.

Get the current timestamp with timezone.

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

rdm_timestamptzToString()

RDM_RETCODE rdm_timestamptzToString ( RDM_PACKED_TIMESTAMPTZ_T tszVal,
RDM_DATE_FORMAT date_format,
char date_sep,
RDM_TIME_FORMAT time_format,
char * buf,
size_t bufSize,
size_t * puSize
)

#include <rdmtimestamptzapi.h>

Convert a timestamp with timezone to a string.

Convert a packed timestamp with timezone to a string.

Return values
sOKAY Normal, successful return.
eBASE_INVDATE Invalid date value.
eINVDATESEP Invalid date separator.
sTRUNCATE Result is truncated.
Parameters
[in] tszVal RDM timestamp with timezone value
[in] date_format RDM date format
[in] date_sep date separator
[in] time_format RDM time format
[out] buf result timestamp with timezone string
[in] bufSize buffer size in number of ASCII characters it can hold
[out] puSize resulting size in number of characters

rdm_timestamptzToTimestamp()

RDM_RETCODE rdm_timestamptzToTimestamp ( RDM_PACKED_TIMESTAMPTZ_T tstzVal,
int16_t tz_disp,
RDM_PACKED_TIMESTAMP_T * pTsVal
)

#include <rdmtimestamptzapi.h>

Convert a timestamp with timezone to a string.

Convert a packed timestamp with timezone to local timestamp.

Return values
sOKAY Normal, successful return.
Parameters
[in] tstzVal timestamp with timezone value
[in] tz_disp local timezone
[out] pTsVal resulting local timestamp value

rdm_timestamptzZero()

RDM_PACKED_TIMESTAMPTZ_T rdm_timestamptzZero ( void )

#include <rdmtimestamptzapi.h>

Get the timestamp of the epoch.

Get the timestamp with timezone of the epoch.

Returns
The timestamp of the epoch

rdm_timestampWeek()

uint16_t rdm_timestampWeek ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the week of the year.

Get the week of the year in US locale.

Returns
The week of the year (1 - 53)
Parameters
[in] ts RDM timestamp value

rdm_timestampYear()

int32_t rdm_timestampYear ( RDM_PACKED_TIMESTAMP_T ts )

#include <rdmtimestampapi.h>

Get the year.

Get the year from a packed local timestamp.

Returns
The yead

rdm_timestampZero()

RDM_PACKED_TIMESTAMP_T rdm_timestampZero ( void )

#include <rdmtimestampapi.h>

Get the timestamp of the epoch.

Get the local timestamp of the epoch.

Returns
The timestamp of the epoch