HALFRED  0.4.0
Functions
OSCalTime interface

Detailed Description

An interface to system calendar time provided by the OS. The implementation and the capabilities of the OSCalTime depend on the OS used.

Functions

OSCalTime OSCALTIME_Get (void)
 
HALRESULT OSCALTIME_Set (OSCalTime time)
 
HALRESULT OSCALTIME_Adjust (OSCalTime timeadj)
 
HALRESULT OSCALTIME_ToDateTime (OSCalTime time, uint16_t *year, uint8_t *month, uint8_t *day, uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *nanoseconds)
 
HALRESULT OSCALTIME_FromDateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t nanoseconds, OSCalTime *time)
 
int64_t OSCALTIME_ToNS (OSCalTime time)
 
OSCalTime OSCALTIME_FromNS (int64_t ns)
 
HALRESULT OSCALTIME_ToString (OSCalTime time, char *str)
 

Function Documentation

OSCalTime OSCALTIME_Get ( void  )

Gets the current system calendar time.

Returns
current calendar time.
HALRESULT OSCALTIME_Set ( OSCalTime  time)

Sets the current calendar time.

Parameters
timecalendar time to set
Returns
HALRESULT_OK on success. Other values indicate error.
HALRESULT OSCALTIME_Adjust ( OSCalTime  timeadj)

Adjusts the current calendar time by a given time amount.

Parameters
timeadjtime adjustment
Returns
HALRESULT_OK on success. Other values indicate error.
HALRESULT OSCALTIME_ToDateTime ( OSCalTime  time,
uint16_t *  year,
uint8_t *  month,
uint8_t *  day,
uint8_t *  hours,
uint8_t *  minutes,
uint8_t *  seconds,
uint32_t *  nanoseconds 
)

Converts the given calendar time to human readable form.

Parameters
timecalendar time to convert
yearplace to store year
monthplace to store month
monthplace to store month
dayplace to store day
hoursplace to store hours
minutesplace to store minutes
secondsplace to store seconds
nanosecondsplace to store nanoseconds
Returns
HALRESULT_OK on success. Other values indicate error.
HALRESULT OSCALTIME_FromDateTime ( uint16_t  year,
uint8_t  month,
uint8_t  day,
uint8_t  hours,
uint8_t  minutes,
uint8_t  seconds,
uint32_t  nanoseconds,
OSCalTime *  time 
)

Converts the given time into OS calendar time.

Parameters
yearyear (in example 2013)
monthmonth number (1 - January, 12 - December)
dayday (1..31)
hourshour (0..23)
minutesminutes (0..59)
secondsseconds (0..59)
nanosecondsnanoseconds (0..999999999)
timeplace to store calendar time
Returns
HALRESULT_OK on success. Other values indicate error.
int64_t OSCALTIME_ToNS ( OSCalTime  time)

Converts the given calendar time into a number of nanoseconds since Jan 1st 1970.

Parameters
timecalendar time
Returns
number of nanoseconds since Jan 1st 1970
OSCalTime OSCALTIME_FromNS ( int64_t  ns)

Converts the given number of nanoseconds since Jan 1st 1970 into a calendar time.

Parameters
nsnumber of nanoseconds since Jan 1st 1970
Returns
calendar time
HALRESULT OSCALTIME_ToString ( OSCalTime  time,
char *  str 
)

Converts the given calendar time into a string representation of "YYYY-MM-DD hh:mm:ss.nanosecond"

Parameters
timecalendar time
strplace to store the string (must be at least 32 characters long)
Returns
HALRESULT_OK on success. Other values indicate error.