Utility Functions

Overview

Common utility and helper functions.

This group defines a set of common support and helper functions.

+ Collaboration diagram for Utility Functions:

Functions

long LCB_GetCurrentTime (unsigned long *pTime)
 Returns the current local system time as a C like time type. More...
 
long LCB_MakeTime (unsigned short Year, unsigned char Month, unsigned short Day, unsigned char Hour, unsigned char Minute, unsigned char Second, unsigned long *pTime)
 Converts splitted time parameters into a C like time value. More...
 
long LCB_SplitTime (unsigned long Time, unsigned short *pYear, unsigned char *pMonth, unsigned short *pDay, unsigned char *pHour, unsigned char *pMinute, unsigned char *pSecond)
 Splits a time value into its single components. More...
 
long LCB_TimeToStr (unsigned long Time, char *pTimeStrBuf, unsigned char BufSize)
 Converts a time value into a string YYYY-MM-DD HH:mm:ss. More...
 

Function Documentation

long LCB_GetCurrentTime ( unsigned long *  pTime)

Returns the current local system time as a C like time type.

Parameters
[out]pTimeThe current local system time
Returns
Error code - ERR_NOERR indicates success
long LCB_MakeTime ( unsigned short  Year,
unsigned char  Month,
unsigned short  Day,
unsigned char  Hour,
unsigned char  Minute,
unsigned char  Second,
unsigned long *  pTime 
)

Converts splitted time parameters into a C like time value.

Parameters
[in]YearYear i.e. 2009
[in]MonthThe month from 1 - 12
[in]DayDay of month from 1 - 31
[in]HourHour of day 0 - 23
[in]MinuteMinute of hour from 0 - 59
[in]SecondSecond of minute from 0 - 59
[out]pTimeReturns converted time value
Note
Some functions require a time value. You can create this time value by calling this function
Returns
Error code - ERR_NOERR indicates success
long LCB_SplitTime ( unsigned long  Time,
unsigned short *  pYear,
unsigned char *  pMonth,
unsigned short *  pDay,
unsigned char *  pHour,
unsigned char *  pMinute,
unsigned char *  pSecond 
)

Splits a time value into its single components.

Parameters
[in]TimeThe time value to be converted
[out]pYearYear i.e. 2009
[out]pMonthThe month from 1 - 12
[out]pDayDay of month from 1 - 31
[out]pHourHour of day 0 - 23
[out]pMinuteMinute of hour from 0 - 59
[out]pSecondSecond of minute from 0 - 59
Note
Some functions retrun a time value. You can split this value into single components with this function
Returns
Error code - ERR_NOERR indicates success
long LCB_TimeToStr ( unsigned long  Time,
char *  pTimeStrBuf,
unsigned char  BufSize 
)

Converts a time value into a string YYYY-MM-DD HH:mm:ss.

Parameters
[in]TimeTime value
See also
LCB_GetCurrentTime()
Parameters
[out]pTimeStrBufTime string buffer stores time string
[in]BufSizeSize of string buffer
Returns
Error code - ERR_NOERR indicates success