Azure IoT / azure_c_shared_utility

Dependents:   STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more

azure_c_shared_utility/agenttime.h

Committer:
AzureIoTClient
Date:
2018-10-04
Revision:
49:6bb8b9a66642
Parent:
48:81866008bba4

File content as of revision 49:6bb8b9a66642:

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

/** @file agenttime.h
*    @brief Function prototypes for time related functions.
*
*    @details These functions are implemented with C standard functions,
*    and therefore they are platform independent. But then a platform
*    can replace these functions with its own implementation as necessary.
*/

#ifndef AGENTTIME_H
#define AGENTTIME_H

#include <time.h>
#include "azure_c_shared_utility/umock_c_prod.h"

#ifdef __cplusplus
extern "C"
{
#endif

/** @brief Get current calendar time.
*
*    @details This function provides the same functionality as the
*    standard C @c time() function.
*/
MOCKABLE_FUNCTION(, time_t, get_time, time_t*, currentTime);

/** @brief Get UTC in @c tm struct.
*
*    @details This function provides the same functionality as the
*    standard C @c gmtime() function.
*/
MOCKABLE_FUNCTION(, struct tm*, get_gmtime, time_t*, currentTime);

/** @brief Get current time representation of the given calendar time.
*
*    @details This function provides the same functionality as the
*    standard C @c mktime() function.
*/
MOCKABLE_FUNCTION(, time_t, get_mktime, struct tm*, cal_time);

/** @brief Gets a C-string representation of the given time.
*
*    @details This function provides the same functionality as the
*    standard C @c ctime() function.
*/
MOCKABLE_FUNCTION(, char*, get_ctime, time_t*, timeToGet);

/** @brief Gets the difference in seconds between @c stopTime and
*    @c startTime.
*
*    @details This function provides the same functionality as the
*    standard C @c difftime() function.
*/
MOCKABLE_FUNCTION(, double, get_difftime, time_t, stopTime, time_t, startTime);

#ifdef __cplusplus
}
#endif

#endif  // AGENTTIME_H