Azure IoT common library
Dependents: STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more
agenttime_mbed.c@48:81866008bba4, 2018-09-11 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Tue Sep 11 11:15:08 2018 -0700
- Revision:
- 48:81866008bba4
- Parent:
- 0:fa2de1b79154
1.2.9
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 | } |