Azure IoT common library
Fork of azure_c_shared_utility by
agenttime_mbed.c@34:651c23af382c, 2017-08-24 (annotated)
- Committer:
- wiggly
- Date:
- Thu Aug 24 14:14:15 2017 +0100
- Revision:
- 34:651c23af382c
- Parent:
- 0:fa2de1b79154
Pass in network stack to platform initialisation
Remove NTP setup from azure platform code
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. |
Azure.IoT Build | 0:fa2de1b79154 | 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 | } |