AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::avsCommon::utils::timing::SafeCTimeAccess Class Reference

#include <SafeCTimeAccess.h>

Public Member Functions

bool getGmtime (const std::time_t &time, std::tm *calendarTime)
 
bool getLocaltime (const std::time_t &time, std::tm *calendarTime)
 

Static Public Member Functions

static std::shared_ptr< SafeCTimeAccessinstance ()
 

Detailed Description

This class allows access safe access to the multithreaded-unsafe time functions. It is a singleton because there needs to be a single lock that protects the time functions. That single lock is contained within this class.

Member Function Documentation

◆ getGmtime()

bool alexaClientSDK::avsCommon::utils::timing::SafeCTimeAccess::getGmtime ( const std::time_t &  time,
std::tm *  calendarTime 
)

Function to safely call std::gmtime. std::gmtime uses a static internal data structure that is not thread-safe.

Parameters
timeThe time since epoch to convert.
[out]timeThe output in calendar time, expressed in UTC time.
Returns
true if successful, false otherwise.

◆ getLocaltime()

bool alexaClientSDK::avsCommon::utils::timing::SafeCTimeAccess::getLocaltime ( const std::time_t &  time,
std::tm *  calendarTime 
)

Function to safely call std::localtime. std::localtime uses a static internal data structure that is not thread-safe.

Parameters
timeThe time since epoch to convert.
[out]timeThe output in calendar time, expressed in UTC time.
Returns
true if successful, false otherwise.

◆ instance()

static std::shared_ptr<SafeCTimeAccess> alexaClientSDK::avsCommon::utils::timing::SafeCTimeAccess::instance ( )
static

The method for accessing the singleton SafeCTimeAccess class. It returns a shared_ptr so classes that depend on this class can keep it alive until they are destroyed.

Returns
std::shared_ptr to the singleton SafeCTimeAccess object.

The documentation for this class was generated from the following file:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0