IoTivity-Lite
oc_clock_util.h File Reference
#include "oc_config.h"
#include "oc_export.h"
#include "util/oc_compiler.h"
#include <stdbool.h>
#include <stddef.h>

Functions

size_t oc_clock_encode_time_rfc3339 (oc_clock_time_t time, char *out_buf, size_t out_buf_len)
 encode time as rfc3339 time More...
 
oc_clock_time_t oc_clock_parse_time_rfc3339 (const char *in_buf, size_t in_buf_len)
 parse rfc3339 time into oc_clock format More...
 
bool oc_clock_parse_time_rfc3339_v1 (const char *in_buf, size_t in_buf_len, oc_clock_time_t *time)
 parse rfc3339 time into oc_clock format More...
 
size_t oc_clock_time_rfc3339 (char *out_buf, size_t out_buf_len)
 retrieve time as rfc3339 time (e.g. More...
 

Function Documentation

◆ oc_clock_encode_time_rfc3339()

size_t oc_clock_encode_time_rfc3339 ( oc_clock_time_t  time,
char *  out_buf,
size_t  out_buf_len 
)

encode time as rfc3339 time

Parameters
timetime from the oc clock
[out]out_bufallocated buffer to store time in rfc3339 format (cannot be NULL)
out_buf_lenthe allocated buffer size
Returns
size_t the used buffer size

◆ oc_clock_parse_time_rfc3339()

oc_clock_time_t oc_clock_parse_time_rfc3339 ( const char *  in_buf,
size_t  in_buf_len 
)

parse rfc3339 time into oc_clock format

Warning
this implementation cannot distinguish between parsing errors and the start of UNIX epoch (1970-01-01T00:00:00Z) and returns 0 in both cases.
Deprecated:
replaced by oc_clock_parse_time_rfc3339_v1 in 2.2.5.6

◆ oc_clock_parse_time_rfc3339_v1()

bool oc_clock_parse_time_rfc3339_v1 ( const char *  in_buf,
size_t  in_buf_len,
oc_clock_time_t *  time 
)

parse rfc3339 time into oc_clock format

Parameters
in_bufbuffer with rfc3339 time (cannot be NULL)
in_buf_lenthe lenght of the buffer
[out]timethe parsed time (cannot be NULL)
Returns
true if parsing was successful
false otherwise

◆ oc_clock_time_rfc3339()

size_t oc_clock_time_rfc3339 ( char *  out_buf,
size_t  out_buf_len 
)

retrieve time as rfc3339 time (e.g.

string)

Parameters
[out]out_bufallocated buffer (cannot be NULL)
out_buf_lenbuffer lenght of the allocated buffer
Returns
size_t used buffer size