Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
c-utility/adapters/agenttime_mbed.c@0:f7f1f0d76dd6, 2018-08-23 (annotated)
- Committer:
- XinZhangMS
- Date:
- Thu Aug 23 06:52:14 2018 +0000
- Revision:
- 0:f7f1f0d76dd6
azure-c-sdk for mbed os supporting NUCLEO_F767ZI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
XinZhangMS | 0:f7f1f0d76dd6 | 1 | // Copyright (c) Microsoft. All rights reserved. |
XinZhangMS | 0:f7f1f0d76dd6 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
XinZhangMS | 0:f7f1f0d76dd6 | 3 | |
XinZhangMS | 0:f7f1f0d76dd6 | 4 | #include "azure_c_shared_utility/agenttime.h" |
XinZhangMS | 0:f7f1f0d76dd6 | 5 | |
XinZhangMS | 0:f7f1f0d76dd6 | 6 | // mbed version of gmtime() returns NULL. |
XinZhangMS | 0:f7f1f0d76dd6 | 7 | // system RTC should be set to UTC as its localtime |
XinZhangMS | 0:f7f1f0d76dd6 | 8 | |
XinZhangMS | 0:f7f1f0d76dd6 | 9 | time_t get_time(time_t* currentTime) |
XinZhangMS | 0:f7f1f0d76dd6 | 10 | { |
XinZhangMS | 0:f7f1f0d76dd6 | 11 | return time(currentTime); |
XinZhangMS | 0:f7f1f0d76dd6 | 12 | } |
XinZhangMS | 0:f7f1f0d76dd6 | 13 | |
XinZhangMS | 0:f7f1f0d76dd6 | 14 | double get_difftime(time_t stopTime, time_t startTime) |
XinZhangMS | 0:f7f1f0d76dd6 | 15 | { |
XinZhangMS | 0:f7f1f0d76dd6 | 16 | return difftime(stopTime, startTime); |
XinZhangMS | 0:f7f1f0d76dd6 | 17 | } |
XinZhangMS | 0:f7f1f0d76dd6 | 18 | |
XinZhangMS | 0:f7f1f0d76dd6 | 19 | |
XinZhangMS | 0:f7f1f0d76dd6 | 20 | struct tm* get_gmtime(time_t* currentTime) |
XinZhangMS | 0:f7f1f0d76dd6 | 21 | { |
XinZhangMS | 0:f7f1f0d76dd6 | 22 | return localtime(currentTime); |
XinZhangMS | 0:f7f1f0d76dd6 | 23 | } |
XinZhangMS | 0:f7f1f0d76dd6 | 24 | |
XinZhangMS | 0:f7f1f0d76dd6 | 25 | char* get_ctime(time_t* timeToGet) |
XinZhangMS | 0:f7f1f0d76dd6 | 26 | { |
XinZhangMS | 0:f7f1f0d76dd6 | 27 | return ctime(timeToGet); |
XinZhangMS | 0:f7f1f0d76dd6 | 28 | } |