Azure IoT common library
Dependents: STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more
agenttime_mbed.c@49:6bb8b9a66642, 2018-10-04 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Thu Oct 04 09:17:16 2018 -0700
- Revision:
- 49:6bb8b9a66642
- Parent:
- 48:81866008bba4
1.2.10
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Azure.IoT Build | 0:fa2de1b79154 | 1 | // Copyright (c) Microsoft. All rights reserved. |
Azure.IoT Build | 0:fa2de1b79154 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
Azure.IoT Build | 0:fa2de1b79154 | 3 | |
Azure.IoT Build | 0:fa2de1b79154 | 4 | #include "azure_c_shared_utility/agenttime.h" |
Azure.IoT Build | 0:fa2de1b79154 | 5 | |
Azure.IoT Build | 0:fa2de1b79154 | 6 | // mbed version of gmtime() returns NULL. |
AzureIoTClient | 48:81866008bba4 | 7 | // system RTC should be set to UTC as its localtime |
Azure.IoT Build | 0:fa2de1b79154 | 8 | |
Azure.IoT Build | 0:fa2de1b79154 | 9 | time_t get_time(time_t* currentTime) |
Azure.IoT Build | 0:fa2de1b79154 | 10 | { |
Azure.IoT Build | 0:fa2de1b79154 | 11 | return time(currentTime); |
Azure.IoT Build | 0:fa2de1b79154 | 12 | } |
Azure.IoT Build | 0:fa2de1b79154 | 13 | |
Azure.IoT Build | 0:fa2de1b79154 | 14 | double get_difftime(time_t stopTime, time_t startTime) |
Azure.IoT Build | 0:fa2de1b79154 | 15 | { |
Azure.IoT Build | 0:fa2de1b79154 | 16 | return difftime(stopTime, startTime); |
Azure.IoT Build | 0:fa2de1b79154 | 17 | } |
Azure.IoT Build | 0:fa2de1b79154 | 18 | |
Azure.IoT Build | 0:fa2de1b79154 | 19 | |
Azure.IoT Build | 0:fa2de1b79154 | 20 | struct tm* get_gmtime(time_t* currentTime) |
Azure.IoT Build | 0:fa2de1b79154 | 21 | { |
Azure.IoT Build | 0:fa2de1b79154 | 22 | return localtime(currentTime); |
Azure.IoT Build | 0:fa2de1b79154 | 23 | } |
Azure.IoT Build | 0:fa2de1b79154 | 24 | |
Azure.IoT Build | 0:fa2de1b79154 | 25 | char* get_ctime(time_t* timeToGet) |
Azure.IoT Build | 0:fa2de1b79154 | 26 | { |
Azure.IoT Build | 0:fa2de1b79154 | 27 | return ctime(timeToGet); |
Azure.IoT Build | 0:fa2de1b79154 | 28 | } |