framework/c/inc/le_clock.h File Reference

Go to the source code of this file.

Data Structures

struct  le_clk_Time_t

Defines

String Formats

Pre-defined formats for converting time to string format. These pre-defined formats use the conversion specifiers from strftime().

#define LE_CLK_STRING_FORMAT_DATE_TIME   "%c"
 Preferred date and time format for current locale, e.g. "Mon Jan 21 13:37:05 2013".
#define LE_CLK_STRING_FORMAT_DATE   "%x"
 Preferred date format for current locale, e.g. "01/21/13".
#define LE_CLK_STRING_FORMAT_TIME   "%X"
 Preferred time format for current locale, e.g. "13:37:05".

Functions

le_clk_Time_t le_clk_GetRelativeTime (void)
le_clk_Time_t le_clk_GetAbsoluteTime (void)
le_clk_Time_t le_clk_Add (le_clk_Time_t timeA, le_clk_Time_t timeB)
bool le_clk_GreaterThan (le_clk_Time_t timeA, le_clk_Time_t timeB)
le_clk_Time_t le_clk_Sub (le_clk_Time_t timeA, le_clk_Time_t timeB)
le_clk_Time_t le_clk_Multiply (le_clk_Time_t timeA, int scaleFactor)
le_result_t le_clk_GetUTCDateTimeString (const char *formatSpecStr, char *destStr, size_t destSize, size_t *numBytesPtr)
le_result_t le_clk_GetLocalDateTimeString (const char *formatSpecStr, char *destStr, size_t destSize, size_t *numBytesPtr)

Detailed Description

Legato Real-time Clock API include file.

Copyright (C) Sierra Wireless, Inc. 2014. All rights reserved. Use of this work is subject to license.


Function Documentation

Add two time values together, and return the result.

Returns:
Sum of the two time values

Get absolute time since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).

Returns:
Absolute time in seconds/microseconds
Note:
Absolute time includes any time that the processor is suspended.
le_result_t le_clk_GetLocalDateTimeString ( const char *  formatSpecStr,
char *  destStr,
size_t  destSize,
size_t *  numBytesPtr 
)

Get the Local date/time as a formatted string.

The formatted date/time string, including NULL-terminator, will be copied to the destination buffer, provided it fits, and the number of bytes copied (not including the NULL-terminator) will be returned in numBytesPtr.

If the formatted date/time string does not fit in the destination buffer, then the contents of the destination buffer will be undefined, and the value returned in numBytesPtr will be zero.

Returns:
  • LE_OK if the formatted string was copied to destStr.
  • LE_OVERFLOW if the formatted string would not fit in destStr.
Parameters:
[in]formatSpecStrFormat specifier string, using conversion specifiers defined for strftime().
[out]destStrDestination for the formatted date/time string
[in]destSizeSize of the destination buffer in bytes.
[out]numBytesPtrNumber of bytes copied, not including NULL-terminator. Parameter can be set to NULL if the number of bytes copied is not needed.

Get relative time since a fixed but unspecified starting point.

Returns:
Relative time in seconds/microseconds
Note:
Relative time includes any time that the processor is suspended.
le_result_t le_clk_GetUTCDateTimeString ( const char *  formatSpecStr,
char *  destStr,
size_t  destSize,
size_t *  numBytesPtr 
)

Get the UTC date/time as a formatted string.

The formatted date/time string, including NULL-terminator, will be copied to the destination buffer, provided it fits, and the number of bytes copied (not including the NULL-terminator) will be returned in numBytesPtr.

If the formatted date/time string does not fit in the destination buffer, the contents of the destination buffer will be undefined and the value returned in numBytesPtr will be zero.

Returns:
  • LE_OK if the formatted string was copied to destStr
  • LE_OVERFLOW if the formatted string would not fit in destStr
Parameters:
[in]formatSpecStrFormat specifier string, using conversion specifiers defined for strftime().
[out]destStrDestination for the formatted date/time string
[in]destSizeSize of the destination buffer in bytes.
[out]numBytesPtrNumber of bytes copied, not including NULL-terminator. Parameter can be set to NULL if the number of bytes copied is not needed.
bool le_clk_GreaterThan ( le_clk_Time_t  timeA,
le_clk_Time_t  timeB 
)

Compare two time values.

Returns:
  • TRUE if TimeA > TimeB
  • FALSE otherwise
le_clk_Time_t le_clk_Multiply ( le_clk_Time_t  timeA,
int  scaleFactor 
)

Multiply the time by a scale factor, and return the result

Returns:
Time multiplied by scale factor

Subtract two time values, and return the result.

Returns:
Result of (timeA - timeB)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines