nl::Weave::Profiles::Time::TimeZoneUtcOffset

#include <src/lib/profiles/time/WeaveTime.h>

Codec for UTC offset of a timezone.

Summary

Constructors and Destructors

TimeZoneUtcOffset()

Public attributes

mSize
uint8_t
number of valid entries in mUtcOffsetRecord
mUtcOffsetRecord[WEAVE_CONFIG_TIME_NUM_UTC_OFFSET_RECORD]
entries of UTC offsets

Public static attributes

BufferSizeForEncoding = 2 + 8 + 4 + (WEAVE_CONFIG_TIME_NUM_UTC_OFFSET_RECORD - 1) * 8
const uint32_t
TimeZoneUtcOffset::BufferSizeForEncoding is a compile time constant, which can be used to declare byte arrays.

Public functions

Decode(const uint8_t *const aInputBuf, const uint32_t aDataSize)
decode UTC offsets from a byte string, extracted from Weave TLV.
Encode(uint8_t *const aOutputBuf, uint32_t *const aDataSize)
encode UTC offsets into a buffer.
GetCurrentLocalTime(timesync_t *const aLocalTime, const timesync_t aUtcTime) const
convert UTC time to local time, using the UTC offsets stored.

Structs

nl::Weave::Profiles::Time::TimeZoneUtcOffset::UtcOffsetRecord

conversion information

Public attributes

mSize

uint8_t mSize

number of valid entries in mUtcOffsetRecord

mUtcOffsetRecord

UtcOffsetRecord mUtcOffsetRecord[WEAVE_CONFIG_TIME_NUM_UTC_OFFSET_RECORD]

entries of UTC offsets

Public static attributes

BufferSizeForEncoding

const uint32_t BufferSizeForEncoding = 2 + 8 + 4 + (WEAVE_CONFIG_TIME_NUM_UTC_OFFSET_RECORD - 1) * 8

TimeZoneUtcOffset::BufferSizeForEncoding is a compile time constant, which can be used to declare byte arrays.

Callers shall prepare enough buffer size for encoding to complete successfully, and BufferSizeForEncoding is the longest buffer that could be needed.

Public functions

Decode

WEAVE_ERROR Decode(
  const uint8_t *const aInputBuf,
  const uint32_t aDataSize
)

decode UTC offsets from a byte string, extracted from Weave TLV.

data type for size is the same as WeaveTLV.h

Details
Parameters
[in] aInputBuf
A pointer to the input data buffer
[in] aDataSize
number of bytes available
Returns
WEAVE_NO_ERROR on success

Encode

WEAVE_ERROR Encode(
  uint8_t *const aOutputBuf,
  uint32_t *const aDataSize
)

encode UTC offsets into a buffer.

data type for size is the same as WeaveTLV.h

Details
Parameters
[out] aOutputBuf
A pointer to the output data buffer
[in,out] aDataSize
A pointer to number of bytes available in aOutputBuf at calling and will be changed to indicate number of bytes used after the function returns.
Returns
WEAVE_NO_ERROR on success

GetCurrentLocalTime

WEAVE_ERROR GetCurrentLocalTime(
  timesync_t *const aLocalTime,
  const timesync_t aUtcTime
) const 

convert UTC time to local time, using the UTC offsets stored.

Details
Parameters
[out] aLocalTime
A pointer to the resulting local time
[in] aUtcTime
UTC time
Returns
WEAVE_NO_ERROR On success. WEAVE_ERROR_KEY_NOT_FOUND if it couldn't find reasonable results

TimeZoneUtcOffset

 TimeZoneUtcOffset()